I donβt think JavaEE 6 offers transaction demarcation annotations like Spring, for example. The closest analogue, I think, is to use a non-EJB beans session, which by their nature are transactional but clearly not demarcated as such (someone, please correct me if I'm wrong).
This is your call regarding which API you have chosen to connect your code to. The advantage of using Spring @Transactional
is that you are not dependent on the particular transaction API used ( @Transactional
can work with JTA, JPA, Hibernate or raw JDBC transactions without changing the code). But of course you are attached to Spring.
If the annotation style is what you want, I don't see an alternative to Spring unless you want to fully embrace JavaEE and use EJB 3.x annotations.
source share