Feb 20th, 2012, 12:19 AM
Data is not getting committed when the transaction propogation is NEVER
I have a method whose transaction propogation is set to NEVER in the class which is annotated as @Service. In the method, I am updating an entity and adding an entity using EntityManager merge and persist, but the data is not getting updated or inserted into the database and there are no exception in the log. Please advise me to resolve this issue.
Feb 20th, 2012, 02:04 AM
Well you have no transaction, data modifications without a transaction is going to do nothing in the database. To change data in the database you need a transaction.
Feb 20th, 2012, 03:30 AM
Thank you for the reply.
But, the data is getting committed when I explicity call hibernate session.flush() in the method where transaction propogation is set to NEVER. Is it a desired behavior?
Feb 20th, 2012, 04:07 AM
Flush flushes the queries to the database, if you have a MySQL table that doesn't support transactions that is the same as committing else it shouldn't persist.