-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate Criteria query returns deleted objects
PostPosted: Mon Dec 12, 2011 10:30 am 
Newbie

Joined: Mon Dec 12, 2011 10:19 am
Posts: 3
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 Hibernate 2)
Hibernate 3.6.8 is used.
Both session.delete() and createCriteria are in the same session and parts of the same transaction.

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
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);
} else {


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.