Note that there are some explanatory texts on larger screens.

plurals
  1. POhibernate would not able to save object sequentially in DB
    text
    copied!<p>There are 3 user logged in a application ,say A,B,C. I had implemented a business logic if user A save a Object(using hibernate)in DB (say Employee object) for other it will mark as "duplicate" processing state in Employee table (every records have a Processing State like success, error, duplicate). I put the code block in which employee object is persisted in synchronization block. But my problem is “when all 3 user click on save employee button at same time ,3 object are save in DB, the code in synchronization block are executing serially for all 3 user but it save object in DB at same time due to that I am not able to mark the record as duplicate (before save the object I have a check of processing state)”. I want to save object one by one means if all 3 are click on save Employee button same time, the thread which enter first in synchronization block the should save the employee object 1st so that I can mark the records duplicate for other.</p> <p>I have implemented code as below</p> <pre><code>synchronized(this){ find processing state of each records. if record is have success status mark as duplicate else save the object in DB with status proccesing (by using hibernate) save function is { session().save(object) (hibernate session ) session().flush(); } // do some other work update the records status success }// close the synchronized block </code></pre> <p>If 1st user save records successfully. But I am not able to get records status “success for other use” </p> <p>Please Help</p> <p>Thanks</p>
 

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