Thanks with warm regards,
Barnabas Jeremiah
Bill Gorder wrote:Barnabas,
Please edit your post and UseCodeTags, increasing code readability will increase the likelihood you get a response.
Thanks with warm regards,
Barnabas Jeremiah
Bill Gorder wrote:Thanks Barnabas,
EJB are not in my realm of experience but on first glance you are not binding the current session to the JTA session. See this document
https://community.jboss.org/wiki/SessionsAndTransactions#Transaction_demarcation_with_JTA
Note you are missing this part:
Now if you wanted to make use of declaritive transactions you could use this strategy
https://community.jboss.org/wiki/SessionsAndTransactions#Transaction_demarcation_with_EJBCMT
Then you could do something more like what you tried in your code, but you would have to edit the hibernate.transaction.factory_class per the document as well though.
You also should not create this every operation
This is expensive see this portion of the document
https://community.jboss.org/wiki/SessionsAndTransactions#What_about_the_SessionFactory
Also you should not be creating an insert statement like you are. Just create a person object and pass it to save. Hibernate will take care of inserting it into your database.
Lasty in your persistence unit do you have transaction-type="JTA" ?
Thanks with warm regards,
Barnabas Jeremiah
Thanks with warm regards,
Barnabas Jeremiah
Barnabas Jeremiah wrote: sorry for the misunderstanding
Don't get me started about those stupid light bulbs. |