• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using joinTransaction() on resource-local entity managers.

 
Treimin Clark
Ranch Hand
Posts: 757
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What will happen if we use the joinTransaction() method on a resource-local EntityManager?
 
Ralph Jaus
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you expect to happen ?
 
Treimin Clark
Ranch Hand
Posts: 757
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ralph Jaus wrote:What do you expect to happen ?


I expect a runtime exception or transaction rollback or something like that. Because the resource-local EntityManager uses EntityTransaction and it couldn't be joined to the active JTA Transaction. Am I correct? Please tell me what will really happen here?
 
Ralph Jaus
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Treimin,

I did a test using glassfish/toplink and the result was

Message ID: javax.persistence.TransactionRequiredException

Complete Message: joinTransaction has been called on a resource-local EntityManager which is unable to register for a JTA transaction.

But I'm not aware if it is specified in the JPA spec which exception exactly (e.g. TransactionRequiredException or IllegalStateException) has to be thrown here.
 
Treimin Clark
Ranch Hand
Posts: 757
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ralph.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic