I had posted this question on dropwizard-dev, should've posted it here. 
Posting it again:

I actively use Dropwizard in my workplace, and a few supporting packages:

1. Dropwizard
2. Guice
3. Hibernate

Dropwizard Hibernate bundle provides transactional support through the 
@UnitOfWork interface. However, UnitOfWork only works on resource methods. 
Upon going through the @UnitOfWorkApplicationListener, I saw that this 
functionality (limiting to resource methods) is intentional. I would like 
to know a couple of things:

1. Why was the @UnitOfWork aspect made to work only for resource methods?
2. Is there an existing annotation which supports opening a session and a 
transaction which is NOT bound to resource methods?

I have written my own aspect @Transactional using MethodInterceptor and 
integration with Google Guice, which provides transactional support:

a) Opening a new session
b) Beginning a transaction
c) Committing a transaction
d) Rolling back a transaction
e) Closing the session

This aspect is very similar to @UnitOfWork, and it's not limited to 
resource methods. Is there an easier solution to this that I have missed?

Thanks and Regards,
Hrishikesh Murali

You received this message because you are subscribed to the Google Groups 
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dropwizard-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to