Hello!
I was trying to refresh a transient object after an insert (a new db entry) and it did not work. Could anybody tell me why it doesn´t work for me?
I´m working in a Web Application with Spring and I need to handle the last inserted object in another page.
I have following code:
Code:
public class GenericDao extends HibernateDaoSupport {
...
public void save(Object obj) {
getHibernateTemplate().saveOrUpdate(obj);
getHibernateTemplate().flush();
getHibernateTemplate().refresh(obj);
}
...
}
The execution of this code throws following Exception:
org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException: No row with the given identifier exists: [model.Workstep#0]; nested exception is org.hibernate.UnresolvableObjectException: No row with the given identifier exists: [model.Workstep#0]
org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:642)
org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:377)
org.springframework.orm.hibernate3.HibernateTemplate.refresh(HibernateTemplate.java:557)
org.springframework.orm.hibernate3.HibernateTemplate.refresh(HibernateTemplate.java:553)
Does anybody know how to solve it?
Best Regards
Wagner