I have a situation today where the following method is returning a stale version of an object. When I look at the database, it is current! I have set a break point in my IDE and drilled into the PersistentContext. I see the object in the entityByKey Map, and it is stale. Any ideas?
public Object getObject(Class clazz, Long id) {
try {
begin();
Object o = sess.get(clazz, id);
commit();
log.debug("getObject(Class clazz, long id) returning:" + o);
return o;
} catch (HibernateException e) {
log.error(e);
commit();
return null;
}
}
Thanks,
Scott
|