• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

COMMIT is not allowed in a subordinate session

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In My Servlet, I am using JTA transaction which is not a CMT.
I am running this on Oracle XADatasource.

When I'm trying to perform the DB operation, I'm getting the
Exception saying "COMMIT is not allowed in a subordinate session "

Any inputs on this please

My Servlet code is :



My Persistence.xml is
 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The issue is probably related to you acquiring your EntityManager outside of the JTA transaction. Unless you use a managed (injected) EntityManager, it will be bound to only the JTA transaction that it was acquired in. You can use joinTransaction() to join a new JTA transaction.

So either move your initEM after the begin, or call joinTransaction, or inject the EM.

See,
http://en.wikibooks.org/wiki/Java_Persistence/Transactions#Join_Transaction
 
reply
    Bookmark Topic Watch Topic
  • New Topic