Comment by [email protected]:

I think the documentation on this could be very much improved -- I discovered the exact same things as above.

For users coming from a hibernate background, @Injecting an EntityManager is akin to a Session. That's fine if the outer object is created when a session is already in-progress (I.E: the unit-of-work is already active).

However, If it isn't, this is really bad. The session creation starts the UOW, so the transaction end doesn't close the session. This leads to all sorts of unexpected issues.

You almost certainly always want to always, always, always use Provider<EntityManager>. This is the spring-equivalent of injecting your SessionFactory.

For more information:
https://code.google.com/p/google-guice/wiki/JPA

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to