[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3494?page=c...
]
Stephane Gallès commented on HHH-3494:
--------------------------------------
I've experienced the exact same problem with Hibernate 3.3.1.GA (and oracle 10/11). I
had to replace a getSingleResult by a getResultList for a request "select from Foo
..." where Foo is an abstract @MappedSuperclass with three implementations with tree
tables (and, hence, there are at least three SQL requests generated).
AFAICT It looks like a regression as the exact same code used to work with Hibernate
3.2.3
For me, the issue was triggered by a migration JBOSS 4.2 -> JBOSS 5.1 (ie : Hibernate
3.2.3 -> Hibernate 3.3.1)
HQLQueryPlan gives back zero result for "getSingleResult()"
although one result is available
--------------------------------------------------------------------------------------------
Key: HHH-3494
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3494
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.3.1
Environment: 3.3.1.GA, hsqldb 1.8.0.7
Reporter: Christian Hofschroer
Attachments: patch.txt
Original Estimate: 168h
Remaining Estimate: 168h
I have run the following code snippets both and only the second one works, because there
is a bug in HQLQueryPlan.
// This does not work correctly (query is javax.persistence.Query)
ExampleObject e = (ExampleObject) query.getSingleResult();
// Replacement with this code works
List l=query.getResultList() ;
assertEquals(1,l.size()) ;
ExampleObject e=(ExampleObject)l.get(0) ;
This problem occurs only in seldom cases when
1. Hibernate executes several sql queries and merges the result
and
2. There is a limit of results (the limit is "2" in version 3.3.1.GA, because
only one result is expected anyway)
Attached is a patch for the class HQLQueryPlan. The line
if ( distinction.add( result ) ) {
has to be replaced with
if ( ! distinction.add( result ) ) {
In case the object was found it returns "true". With the current implementation
the object is not added to "combinedResults" although it should be added.
It was not possible to reproduce the problem with the setup from "testsuite".
If necessary I can provide a JUnit testcase.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira