Hi,
Following code is trying to save a new record with an email which already
exists, after running, then try to update the same record in another progam,
I got:
Lock wait timeout exceeded; try restarting transaction
un comment out //sessionManager.Abort, above problem fixed. but I still get
this error in the log, looks like after abort, hibernate still trying to
save:
[ERROR] JDBCExceptionReporter Duplicate entry '[EMAIL PROTECTED]' for key
2
[INFO] TimingFilter Request time: 42 ms
[ERROR] AssertionFailure an assertion failure occured (this may indicate a
bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: null id in org.bfe.istudio.t5.entities.Usr
entry (don't flush the Session after an exception occurs)
at
org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:55)
at
org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:157)
...
@Inject private Session session;
@Inject
private HibernateSessionManager sessionManager;
public void onActivate() {
Usr usr = new Usr();
usr.setName("123");
usr.setEmail("[EMAIL PROTECTED]");
try {
session.save(usr);
} catch (HibernateException e) {
//sessionManager.abort();
}
<property name="hibernate.connection.autocommit">false</property>
--
View this message in context:
http://www.nabble.com/t5%3A-handling-of-hibernate-exceptions-tp16047005p16047005.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]