Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Transaction

 
Ashok Kumar
Greenhorn
Posts: 7
Chrome Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.lang.IllegalStateException: Transaction already active

Please give the solution for this am new to JPA.
I have correctly give the begin transaction & commit it
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Ashok Rocks",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted.
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My first question would be are you running inside a EJB Container such that there is already a JTA Transaction started for you? and you might also be injecting the EntityManager?

But that is a guess because there are some important details we are missing. If you are in a container and it is giving you a JTA Transaction and handling the transactions, they you don't have to beginTransaction() yourself.

But if I am wrong, please post more info, like your environment and some code.

Thanks

Mark
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!