1

I read this topic (https://blogs.oracle.com/theaquarium/entry/jta_1_2_it_s) talk about JTA 1.2 can be used without EJB. So i would like to know if is possible use JTA 1.2 only with CDI within TOMCAT 7 (or lastest version).

Today i'm using DeltaSpike to control my transactions but i would like to change and start using JTA 1.2, because i need "REQUIRES_NEW, SUPPORT and others" that deltaSpike don't have.

Can i use JTA 1.2 without a Server Application like Jboss, Glassfish, TomEE ?

Ronaldo Lanhellas
  • 2,975
  • 5
  • 46
  • 92
  • it also can be used without CDI, what is the question? – Roman C Mar 05 '17 at 13:26
  • The question is: Can i use JTA 1.2 without a Server Application like Jboss, Glassfish, TomEE ? – Ronaldo Lanhellas Mar 05 '17 at 13:55
  • If you really need JTA, then you better use a full-blown application server. Otherwise, just stick with plain JDBC (JTA still uses JDBC under the hood). You can easily implement simple transaction management in JDBC (by setting setAutoCommit() to false and calling commit() to persist your changes (or rollback() in case of an error). – dsp_user Mar 05 '17 at 15:47
  • I can't understand why a Container-Server like Tomcat can support JTA. Can you explain ? – Ronaldo Lanhellas Mar 05 '17 at 15:51

1 Answers1

0

Tomcat doesn't provide JTA because it doesn't have any transaction manager. So the answer to your question is NO.

You can find additional information on how to use JTA in Tomcat here: How to use JTA support in Tomcat 6 for Hibernate?

If you really need JTA, I think it's better to use a full-JEE application server. Else you van also manage the Transaction by yourself.

Community
  • 1
  • 1
Rouliboy
  • 1,377
  • 1
  • 8
  • 21