Hi,
I was trying to initialize the association by using HibernateCallBack for detached objects. However, I was seeing some update statements being fired even though I was just trying to reattach (lock) the object back to the current hibernate session within the HibernateTemplate. It looks like this was also related to the fact that the table has the version column inside. Am I missing something?
Hibernate version:3.2.4 sp1
Mapping documents:
Code between sessionFactory.openSession() and session.close():
final Object parent = theParent;
final Object child = theChild;
hibernateTemplate.execute(new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException {
session.lock(parent, LockMode.NONE);
Hibernate.initialize(child);
return null;
}});
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Hibernate: update TABLE_A set version=?, CREATED_BY=? ... where ID=? and version=?
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html