Announcement Announcement Module
Collapse
No announcement yet.
Need advice on exception handling approach Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    I am also facing the same problem. Not able to catch those exceptions in Service layer without issuing explicit flush.

    From the above posting, I am not able to find out any concrete solution for this problem.

    So, How to solve this issue ?

    Comment


    • #32
      Also if this problem can be solved using flush, then how can we rollback the transaction?

      If we use flush, Will TransactionManager can rollback this transaction if there is any issue ??

      Comment


      • #33
        Hi haishan,

        Originally posted by haishan View Post
        Also if this problem can be solved using flush, then how can we rollback the transaction?

        If we use flush, Will TransactionManager can rollback this transaction if there is any issue ??
        You can flush (synchronize the state with the database) and later rollback the transaction. This is the equivalent of using straight JDBC and writing to the database with a connection whose autoCommit mode is set to false, and then later rolling back the transaction.

        Hibernate itself (by default) performs a flush prior to a query if there are changes held in memory that would affect the results of a query. This default behavior would not work if you could not later rollback the transaction.

        -Arthur Loder

        Comment

        Working...
        X