Page History
...
HQL is a SQL-like query language that references hibernate object properties rather that table column names.
Common Hibernate Error Messages
LazyInitializationException
For example: LazyInitializationException: failed to lazily initialize ... could not initialize proxy - no Session
- This error means that a Hibernate managed object has outlived its Session. In other words, the object has become "detached" or disconnected from a Session.
- In DSpace, this often means either Context.uncacheEntity() was called on the object too soon, or it a Context.commit() was called (which clears it from Session) and the object was used again later (without first calling Context.reloadEntity())
- More info and tips on avoiding these exceptions: https://developer.atlassian.com/confdev/development-resources/confluence-architecture/hibernate-sessions-and-transaction-management-guidelines
StaleStateException
For example: StaleStateException: Batch update returned unexpected row count from update
- This error means that your Hibernate tried to update an object that either no longer exists in the Database, or the update already previous occurred. In other words, the state of this object was "stale" in the Hibernate cache, and its state in the Database was different.
In DSpace, this may mean that Context.commit() should have been called previously to save the object in question (and ensure the cache and database are synced).
Hibernate Resources
- https://www.lynda.com/Java-tutorials/Java-Database-Access-Hibernate/534635-2.html
- Requires a lynda.com subscription
Overview
Content Tools