Q: So what is the likely cause of the following Hibernate exception:
[AssertionFailure] (JMS SessionPool Worker-2:) 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 entry (don't flush the Session after an exception occurs)
A: After much scratching of heads it turns out it was as simple as a mandatory field not filled in on an object being saved.
So why did we get that message? I've no idea. Maybe its due to one or more of these factors:
* We're using MS SQL and the table had an identity column
* We're using Spring's TransactionSynchronizationManager to manage the transaction
* There is some logical explanation based on a thorough understanding of hibernate's internal mechanisms as to why this particular error means a missing mandatory field. I looked at the source code, but couldn't figure it out.
Its likely that the original error got buried somewhere and this one was a side-effect. However we couldn't see anything in our logs.
Well, now we know.
23 December 2005
Subscribe to:
Posts (Atom)