Results 1 to 3 of 3

Thread: EntityManager.persist() not inserting into DB

Hybrid View

  1. #1
    Join Date
    Mar 2011
    Posts
    2

    Default 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
    Attached Files Attached Files

  2. #2
    Join Date
    Dec 2012
    Posts
    11

    Default

    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.

  3. #3
    Join Date
    Mar 2011
    Posts
    2

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •