Hibernate 级联调试选项
我遇到过级联期间发生的各种 StackOverflowError。这些在调试中非常耗时,因为我不知道哪些属性被级联以导致这种递归行为。有谁知道日志设置或其他形式的调试可以具体告诉我正在级联哪些属性?
I have run into various StackOverflowErrors which occur during cascading. These have been extremely time consuming in debugging because I don't know which properties are being cascaded to cause this recursive behavior. Does anyone know of a log setting or some other form of debugging which could tell me specifically what properties are being cascaded?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在“log4j.properties”文件中,将“log4j.logger.org.hibernate”属性设置为“trace”:
“log4j.logger.org.hibernate=trace”
这为 Hibernate Cascade.cascade() 调用提供 TRACE 输出。
In the "log4j.properties" file set the "log4j.logger.org.hibernate" property to "trace":
"log4j.logger.org.hibernate=trace"
This provides TRACE output for Hibernate Cascade.cascade() calls.
这取决于您定义休眠映射的方式。
如果您已通过 xxx.hbm.xml 定义了映射,则在
如果您已 如果您通过 Java 注释定义了映射,您应该检查 @Cascade 注释的位置以及该注释位于哪个字段。
It's Depending on the way you have defined the hibernate mapping.
If you've defined the mapping via xxx.hbm.xml, then, in the
If you've defined the mapping via Java Annotation, you should check the location of your @Cascade annotation and on which field you have this.