createCriteria returns an object deleted by previous session.delete(). When we try to update object returned by createCriteria, this update fails. createCriteria should not return deleted objects (at least it was not in hiberanate 2). v 3.6.8.Final is used
Is it Hibernate bug? Any workaround for this ?
2011-12-12 13:21:08,020 INFO [Dispatcher-1]REQ2 com.lehman.equities.sds.feed.PersisterDatabase - Delete the expired GUILock [54 | 512]
2011-12-12 13:21:08,025 INFO [Dispatcher-1]REQ2 com.lehman.equities.sds.feed.PersisterDatabase - Update GUILock [54 | 512] -> Mon Dec 12 23:59:59 GMT 2011 2011-12-12 13:21:08,033 ERROR [Dispatcher-1]REQ2 com.lehman.equities.sds.feed.gui.eu.NewGUIUpdateCommand - Error when processing GUI update - com.lehman.equities.sds.exception.InfrastructureException: org.hibernate.ObjectDeletedException: deleted instance passed to update():
Code which looks for objects and updates: GUILock lock = (GUILock) session.createCriteria(GUILock.class) .add(Expression.eq("rowId", rowId)) .add(Expression.eq("columnId", columnId)) .uniqueResult(); if (lock != null) { lock.setExpiryDate(expiryDate); logger.info("Update GUILock [" + lock.getRowId() + " | " + lock.getColumnId() + "] -> " + lock.getExpiryDate()); session.update(lock); }
|