Reputation: 417
I use jpa (eclipselink) + ejb(3) in my project, when i switch off transactions on ejb method there is a problem with a lazy loading. If i try to Eager loading that's ok, but a it have more time to wait. How do you solve problems like that? I think there are 2 methods:
Use the bean management transactions, and load the fields in that transactions (it's difficult because a lot of legacy code i have)
Use the eager initialization in entities.
Do you have any other ideas?
Thank you!
Upvotes: 1
Views: 822
Reputation: 723
2 .Eager loading is not a good idea too, because the risk to load the whole database into memory is really high.
If its possible try to create (named)queries with fetch joins ( see http://www.kumaranuj.com/2013/07/jpa-2-fetch-joins-and-whether-we-should.html ) which only loads data you really need for further processing.
Upvotes: 2