This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I think I'm missing some trivial aspect of Hibernate, but I'm having extreme problems with LazyInitializationExceptions. I've been haing trouble in two places. The first is in a rather simple test case of the service layer. The second is in view code (and yes, I'm using open session in view filters).
My test code:
findById is identical to the code in the Java Persistence with Hibernate book:
If I pass in a lock=true value, I don't get the lazy initialization exception, if I pass in false I get the error. From my understanding, either lock moe should work.
I'm using standard JPA annotations to inject EntityManagers into the services.