users@jersey.java.net

[Jersey] Transactional annotation without JEE

From: marianl <marianl_at_o2.pl>
Date: Sun, 24 Feb 2013 20:49:30 +0100

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