Hi,
I m doing like this. Please let me know where i am going wrong.
I am trying to insert one row under Hibernate Transaction.
Step 1:
i have inserted one row using session.save(myObj) and it saved in a database.
Step 2:
i have deleted row manually in my database.(My application sometime requires manual deletion if application is down for sometime. So i m testing that.)
Step 3 :
when i tried to insert the row using my program, i m getting the insert log stating its being inserted but the row is not inserted in the database and i didnt get any exception.(Transaction is ok i checked FAQ and it said it may be the problem ). I have done
session.flush()
session.clear()
session.close() also in the required places.
When i again run my program, i m getting UNIQUE CONSTRAINT Violated or could not start a new transaction exceptions.
Only if i restart my server then i can able to do my database operations.
Could you please tell me how can i clear cache/session so that i can use Hibernate effectively or am i doing anything wrong in my Transaction settings ?
|