I just want to ask, how to prove that hibernate is doing lazy loading . I have code like this :
And I try to test lazy loading in hibernate (jpa) with this code :
Actually, I don't wont to load "alamat" property, because that's a TEXT. But when I try to debug the code, I get the output trace like this :
Hibernate is still开发者_StackOverflow中文版 select alamat column, and in the debug veriable, I found that Hibernate is really load alamat column :
The Hibernate manual notes:
To enable property level lazy fetching, your classes have to be instrumented: bytecode is added to the original class to enable such feature, please refer to the Hibernate reference documentation. If your classes are not instrumented, property level lazy loading is silently ignored.
How to achieve this is explained in chapter 20.1.8. Using lazy property fetching of the manual. It requires a special build process.
You have to enable bytecode instrumentation to activate lazy loading for properties. If you don't have bytecode instrumentation enabled, Hibernate will ignore any properties about lazy loading (see the docs)
精彩评论