Hi all,
I have a problem about transaction management.
When user clicks insert, I create a transaction and call session.save, but dont commit it, untill user clicks "commit". If user "commit"s, I do some validation check on the operated object, if it is valid , then I call t.commit
else I dont commit it and rollback I changes in RAM level.
insert(Object o) {
t = session.beginTransaction();
session.save(o);
}
commit() {
if (transactionIsValid) {
t.commit;
}
else {
rollBackChangesInRAMLevel();
displayInfoMessage();
t = null;
// Object o = t.getOperatedObject();
//session.evict(o);
}
}
It seems to work, but when user tries to do another operation which is valid, and t.commit called, hibernate flushes the previous non-valid operation.
I tried session.evict(failedObject) but it gives "possible nonthreadsafe access to session" assertion error in t.commit().
What am I missing? What should I do to remove that non-valid object from Hibernate's "mind" and "heart"?
_________________ -developer
|