本文介绍了如何强制Hibernate 3.3或3.5使用CGLib而不是Javassist?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否仍然可以强制Hibernate 3.3或3.5使用CGLib而不是Javassist?在我的属性文件中,我设置了

  hibernate.bytecode.provider = cglib 

但是这似乎没有做到。任何想法?

解决方案

似乎有些人没有正确阅读我的答案,所以我会换个方式: hibernate.properties 看起来正确,属性已定义好,应该可以工作。所以,对于这个问题抱歉,但在类路径上是CGlib?



更新:经过测试,适用于我。这里是我在初始化时获得的输出:

 
15 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.0。 SP1
18 [main] INFO org.hibernate.cfg.Environment - 从资源hibernate.properties加载的属性:{hibernate.bytecode.use_reflection_optimizer = false,hibernate.bytecode.provider = cglib}
20 [main ] INFO org.hibernate.cfg.Environment - 字节码提供程序名称:cglib

注意:

Is it still possible to force Hibernate 3.3 or 3.5 to use CGLib instead of Javassist? In my properties file, I set

hibernate.bytecode.provider = cglib

But this doesn't seem to do it. Any thoughts?

It seems some people didn't read my answer correctly so I'll rephrase: your hibernate.properties looks correct, the property is well defined, it should work. So, sorry for the question but is CGlib on the classpath?

Update: Just tested and it works for me. Here is the output I get at initialization time:

15 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.0.SP1
18 [main] INFO org.hibernate.cfg.Environment - loaded properties from resource hibernate.properties: {hibernate.bytecode.use_reflection_optimizer=false, hibernate.bytecode.provider=cglib}
20 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : cglib

PS: Note that CGLIB support has been deprecated recently (this doesn't mean you won't be able to use CGLIB but the integration it not maintained anymore).

这篇关于如何强制Hibernate 3.3或3.5使用CGLib而不是Javassist?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 05:18