I use JPA (Hibernate) with Spring.
When i want to lazy load a Stirng property i use this syntax:
@Lob
@Basic(fetch = FetchType.LAZY)
public String getHtmlSummary() {
return htmlSummary;
}
But when i look at the sql that hibernate creates, it seems this property is not lazy loaded? I also use this class org.hibernate.tool.instrument.javassist.InstrumentTask in ANT script to instrument this property but it seems it does not work.
Please help me.
Khosro.
解决方案
Lazy Lob loading would require bytecode instrumentation to work properly, so it is not available by default in any JPA implementation I'm aware of.
Your best bet is to put the Lob into a separate entity, like HtmlSummary, and use a lazily loaded one-to-one association.