Comment #9 on issue 597 by [email protected]: Persist Extension: UnitOfWork.begin() throws IllegalStateException when called multiple times
http://code.google.com/p/google-guice/issues/detail?id=597

If you do not want to make the state of the unit of work public then you must prevent the unit of work from being started behind the scene.

This happens in the method
JpaPersistService.get() Which will return the EntityManager. The side effect of this method is that a unit of work is started.

First of all it is bad style to have a getter with a side effect. Rather have the get() throw an IllegalStateException if the unit of work has not been started.

Second most of the programmers are not aware that they are invoking the above method when they have an EntityManager injected into their class. This makes tracking the bug of an already active unit of work a nightmare.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
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