Reputation: 993
According to documentation @Basic By default, EclipseLink JPA ignores the fetch attribute and default javax.persistence.FetchType.EAGER
How do you change the default so that it will lazyload?
Upvotes: 1
Views: 1989
Reputation: 18379
Sorry, that documentation is wrong and confusing. I just updated it.
By default LAZY on a @Basic will work, as long a weaving is enabled. Weaving is enabled by default in JavaEE, and JavaSE when the EclipseLink agent is used. If you are in JavaSE and can't use the agent, then you can use static weaving.
Upvotes: 2
Reputation: 21145
The link you posted also states that lazy on basics and non collection mappings is ignored if weaving is not used. Weaving (via a runtime agent or static weaver) allows the byte code to be changed to add in code neccessary for lazy loading. So try using weaving as described here http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance/Weaving
Upvotes: 1