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(Isolater.java:147) 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.