Status: New
Owner: ----

New issue 731 by spootsy....@gmail.com: Add @UnitOfWork annotation
http://code.google.com/p/google-guice/issues/detail?id=731

Something that seems to be missing from guice-persist is a @UnitOfWork equivalent to the @Transactional annotation. One that will automatically start/stop a UnitOfWork as required, but not begin/commit a transaction.

Our use case: we have a bunch of classes that are used for database access. We use these in command-line applications, both during initialisation (in provider methods) and at run-time.

If a method exists for altering data in the database, we can happily apply @Transactional to it. It can now be safely called whether you're in an active UnitOfWork or not (because @Transactional will only start/stop a UnitOfWork if required).

For methods that only read data from the database, we don't want to start/commit transactions needlessly, so the @Transactional tag is a no-go. But - we have no means of guaranteeing that a method is encapsulated by a UnitOfWork automatically... there's no way to check if a UnitOfWork is already running, so there's no way to start/stop one only as required.

Would be a boon to have this functionality. Alternatively, an "isRunning()" method on UnitOfWork would make it possible for us (and others) to create our own automatic UnitOfWork controllers.

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To post to this group, send email to google-guice-dev@googlegroups.com.
To unsubscribe from this group, send email to 
google-guice-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-guice-dev?hl=en.

Reply via email to