Results 1 to 4 of 4

Thread: Data is not getting committed when the transaction propogation is NEVER

  1. #1
    Join Date
    Feb 2012
    Posts
    2

    Default 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.

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Feb 2012
    Posts
    2

    Default

    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?

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

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