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