Hibernate version:
3.0.5
For many-to-one and one-to-one, H3.0.5 allows lazy=true and lazy=proxy - What is the difference?
I understand if it is a value type, there is no "proxy" per se and lazy=true requires bytecode instrumentation. However, when the referred property is a user defined class type, what is the difference between true and proxy?
The reason I ask this question is that lazy=true and lazy=false behaves differently (which I don't think it makes sense). I have Class A which has a many-to-one relationship with class B (unidirectional). Originally I defined lazy="true" and it worked fine with
H3.0.2. However, if I upgrade to H3.0.5 - it does not work anymore: H3.0.5 eagerly fetching Class B when A is persistent although I defined lazy=true in many-to-one and defined B as a lazy object at class level. Then I changed to lazy="proxy" and lazy fetching worked.
In the mapping file, I did define class B as a lazy obejct.
So what's the differenc betwen lazy=proxy and lazy=true in H3.0.5?
Please also note that H3.0.2 generates an error if lazy=proxy was specified -
Quote:
Error parsing XML: XML InputStream(221) Attribute "lazy" with value "proxy" must have a value from the list "true false ".
H3.0.5 fxed it.
Thanks,