Hi,
Here is an example from dropwizard for hibernate using a RequestDispatcher:
https://github.com/codahale/dropwizard/tree/master/dropwizard-hibernate/src/main/java/com/yammer/dropwizard/hibernate
@UnitOfWork is @Transactional.
And here is small me-too project of how to do it in a pure programmatic way
(can be hooked up to jersey):
https://github.com/gsapountzis/craven
I also recall discussions in the list of various ways to implement
interceptors in jersey but I don't have a link handy.
regards,
George.
On Sun, Feb 24, 2013 at 9:49 PM, marianl <marianl_at_o2.pl> wrote:
> Hello,
>
> I've been wondering how can I achieve that @Transactional annotation in
> non JEE environment using pure Jersey 2.0. (also no Spring)
>
> This is what I've come up with:
>
> low priority ContainerRequestFilter which starts JTA transaction.
> high priority ContainerResponseFilter which commits JTA transaction.
>
> both filters bound to @Transactional
>
> Priorities would help to narrow down transaction so it does not span on
> other filters.
>
> Question is: Where do I rollback?
>
> Do you have some suggestions? I apologise up front if this is some messed
> up idea. I'm just interested.
>
> Kind regards,
> Marek
>