File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Error using Resource Local Entity Manager Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Error using Resource Local Entity Manager" Watch "Error using Resource Local Entity Manager" New topic

Error using Resource Local Entity Manager

Steven Lennon

Joined: Aug 23, 2009
Posts: 5
Hi All,

I am study for the SCBCD exam and trying out different scenerios with JTA and Resource Local Managed Entity Managers. I came across this scenerio which I can't explain what is happening. I am receiving the following error and I'm not sure why.

The code I am using is as follows;

My persistence.xml file is as follows;

The main point is when I have the @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) annotation on the runAccount() method I get the following Exception;

However, if I remove the @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) annotation (which defaults to TransactionAttributeType.REQUIRED) the method works as expected.

My problems is I don't understand why adding @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) annotation would cause the exception as I was under the impression that a Resource-Local Entity Manager does not have to use JTA or container managed transactions and therefore if a container managed transaction was not present (using the NOT_SUPPORTED option) it shouldn't matter. What also adds to my confusion is in the stack trace I see a reference to a org.hibernate.engine.transaction.Isolater$JtaDelegate.delegateWork( class which refers to a JTA delegate and reinforces my belief that JTA is still involved in the Resource-Local transaction.

I would be very appreciative of your help and comments and let me know if I have missed something elementary here.

Thanks in advance.
I agree. Here's the link:
subject: Error using Resource Local Entity Manager
It's not a secret anymore!