Dec 21st, 2012, 09:30 AM
EntityManager.persist() not inserting into DB
I'm new to spring, i have a problem inserting data into DB. I'm able to fetch the data and update the data but not able to insert new row. I see no exception/error in the logs. I have attached both logs and the spring beans xml. Pls help
Following are more details
Using Spring 3.1.2, Hibernate 4.1.6, MySQL as the DB
Dec 21st, 2012, 12:55 PM
Are you wrapping it in a transaction? Is the transaction being committed? In my experience a JPA call that doesn't persist is usually a missing transaction. It doesn't show up as an error, it simply doesn't persist.
Dec 21st, 2012, 04:10 PM
Yes the persist() is being called and i guess this will happen in just one transaction. Also i tried committing the transaction too, it dint work. Also committing transaction is not recommended when we add <tx:annotation-driven transaction-manager="transactionManager" /> in the spring xml, as all the transaction handing will be taken care by spring.
Thanks for the try