jeroend (23) [Avatar] Offline
#1
My question is almost perfectly questioned here: http://stackoverflow.com/questions/4805761/jpa2-hibernate-stop-lazy-loading


I'm having a problem where JPA is trying to lazily load my data when I don't want it to. Essentially what is happening is I'm using a Service to retrieve some data, and when I go to parse that data into JSON, the JSON library is triggering hibernate to try and lazily load the data. Is there any way to stop this? I've given an example below.


Unfortunately there is not really a clear answer yet. I was hoping that chapter 16 or 17 would offer a solution, but I haven't found any.
Is there a chance to share insights on how to accomplish this?

Regards,
Jeroen.
Christian Bauer (56) [Avatar] Offline
#2
Re: lock entities for lazy loading?
Any serialization solution should offer options to exclude certain properties. Chapter 18 will show an example for JAXB/XML serialization but it's not finished.