I am using Toplink JPA. I don't see a way through the EntityManager or the EntityTransaction to set autocommit on or off. I am wondering if I need to resort to writing JDBC in a bean managed session bean.
You are right, you can't auto-commit with JPA, but you can use local transactions.
What are you trying to accomplish? Why is auto-commit important? If you are looking for reduced code, JTA/CMT is a better option? Are you worried about JTA overhead? If so, belive me, it's very trivial compared to the other sources of performnace problems that you ca get from the persistence tier...
Regards,
Reza
Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1
What are you trying to accomplish with auto-commit? It's generally not a good practice in a distributed application. I can understand if you are worried about overhead with JTA (although that's very minor too), BMT will let you use local transactions...
Regards,
Reza
Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1
It was suggested in a design meeting that I use autocommit instead of the transaction handling supplied by the container.
If you say the overhead of starting and ending a transaction using the container managed, I may just stick with container managed. Otherwise, its like fitting a square peg in a round hole.
I only want to insert one record into a table. That's it. Since it was only one step, autocommit was suggested.
Thanks so much for help. It is greatly appreciated.