-->
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.  [ 2 posts ] 
Author Message
 Post subject: Regression in semantics of getSingleResult() with fetch join
PostPosted: Wed Jan 17, 2007 10:08 am 
Newbie

Joined: Wed May 10, 2006 1:05 pm
Posts: 6
Hibernate version: 3.2.0 RC2 / GA
HEM version: 3.2.0 RC1 / GA

Hi,

switching from JBoss 4.0.4 to 4.0.5 and hence from HEM 3.2.0 RC1 to 3.2.0 GA broke some of our queries that used getSingleResult().

I figured out, that from RC1 to RC2 the implementation of getSingleResult() changed (http://fisheye.jboss.org/changelog/Hibernate/?cs=10281) from being based on org.hibernate.Query.uniqueResult() to org.hibernate.Query.list().

Now the problem is, that both implementations behave differently when it comes to fetch join queries - which may deliver duplicate root objects. In this case, the uniqueResult() method, and hence the former implementation of getSingleResult(), is smart enough to just return the only single root object, while the new implementation throws a NonUniqueResultException.

(From hibernate reference : "The uniqueResult() method offers a shortcut if you know your query will only return a single object. Note that queries that make use of eager fetching of collections usually return duplicates of the root objects (but with their collections initialized).")

So the question is: Which is the "right" behaviour? The EJB spec doesn't provide any enlightenment here.

Thanks for your help

Günter


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 21, 2007 8:33 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
That's a bug http://opensource.atlassian.com/projects/hibernate/browse/EJB-263

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.