-->
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.  [ 3 posts ] 
Author Message
 Post subject: Criteria query returns deleted objects
PostPosted: Mon Dec 12, 2011 4:24 pm 
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 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);
}


Top
 Profile  
 
 Post subject: Re: Criteria query returns deleted objects
PostPosted: Tue Dec 13, 2011 5:47 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

first off, this is the wrong forum. This is Hibernate Core question and should be asked on the Hibernate user forum.
In case you are asking the same question there again, I recommend you provide more context. In particular where and when a session gets opened and closed. Provided your deletion of the entity is committed I have a hard time believing that an succeeding query returns the deleted entity.

--Hardy


Top
 Profile  
 
 Post subject: Re: Criteria query returns deleted objects
PostPosted: Wed Dec 14, 2011 1:33 pm 
Newbie

Joined: Mon Dec 12, 2011 10:19 am
Posts: 3
Posted this to Hibernate Core. Can somebody from Hibernate team reply, please?


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

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.