Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I will give some hints but you need to dig into source code and documentation.There are lot of concepts here.</p> <p>Doing some operation on session does not mean that the changes are immediately pushed to db. This depends a lot on the flush mode of the session and operation you are doing. Refer to hibernate documentation on this. Changes are pushed to db when session is flushed. The changes are durable once transaction is committed.</p> <p>It would have worked if you called <code>session.flush()</code> before close, in the commented code but it is unnecessary because of explanation below.</p> <p>In the above code for update and delete, when call 'getCurrentSession', you either get the existing session or get the new session from <code>org.springframework.orm.hibernate4.SpringJtaSessionContext</code>(assuming you are using JTA, again dig into code to understand this).</p> <p>When new session is created Hibernate register synchronization with the transaction. Before complete of the transaction Hibernate will get call back. Here Hibernate will flush the session. In your case the transactions demarcated by spring through the annotations you placed.</p> <p>I advice you to debug the code from call to 'getCurrentSession' in order t understand what is happening. You will come across these classes/methods depending on your configuration.</p> <pre><code> org.hibernate.internal.SessionFactoryImpl.getCurrentSession() org.springframework.orm.hibernate4.SpringJtaSessionContext.buildOrObtainSession() org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion() </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload