javatwo wrote:
code instrumentation is not a clean solution. My understanding is: If a property is declared to lazy, just do not include it in the select statement. It should be very simple.
This is exactly what is done! But how do I know when you access a lazy property and that a second select has to be executed? By using byte code enhancement. The select and the bytecode enhancement are 2 orthogonal notions.
javatwo wrote:
I do not like the way of instrumenting code. I think this is a bug. Delared to be lazy, but not lazy.
Wrong see above.
Quote:
I have a class that has a Lob property that I like to be lazy. I can use query to select all properties except the lob. It is lazy. When I need the lob data, ask EM to load it. The problem is that, Hibernate does not support it in the case of association with other entities. For example,
class A {
@OneToMany(fetch=FetchType.EAGER)
public List<B> getBs();
...
}
class B {
@Basic(fetch=FetchType.Lazy)
@Lob(type=LobType.BLOB)
public getData();
}
When A is loaded, all the Bs will be loaded (eager). I like B's data not to be loaded. However Hibernate ignores Lazy.
2 mistakes here.
@Lob(type=LobType.BLOB, fetch=FetchType.LAZY)
@Basic is not compatible with @Lob
Second a Blob if retrieved in a java.sql.Blob is already lazy as per the JDBC spec.