Opened 15 years ago
Closed 15 years ago
#1364 closed enhancement (fixed)
Update Hibernate when HHH-4065 has been fixed
Reported by: | Nicklas Nordborg | Owned by: | Nicklas Nordborg |
---|---|---|---|
Priority: | major | Milestone: | BASE 2.15 |
Component: | core | Version: | |
Keywords: | Cc: |
Description
The update to Hibernate 3.3.2 in #1350 had a nasty bug as a side-effect. It was possible to workaround this bug with a very ugly hack (see [5037]). Hopefully the Hibernate developers will fix the problem so that we can remove the hack.
Hibernate issue tracker: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4065
Change History (10)
comment:1 by , 15 years ago
comment:3 by , 15 years ago
Hibernate has released 3.5-beta-3 which includes the fix. I'll try it and see how it works.
comment:4 by , 15 years ago
(In [5220]) References #1364: Update Hibernate when HHH-4065 has been fixed
Updates Hibernate to 3.5.0-beta-3. The fix for HHH-4065 seems to work so I have removed the hack. I have not found any other problems either, but I'll leave this ticket open since we should upgrde to 3.5.0.GA when it is released.
comment:5 by , 15 years ago
Milestone: | BASE 2.x+ → BASE 2.15 |
---|
comment:6 by , 15 years ago
comment:7 by , 15 years ago
I have found an issue that is probably related to the new version. It is about how a specific HQL is translated to SQL.
Consider the following HQL which is used to list all samples which hasn't been connected to a well on a plate:
SELECT smp FROM SampleData smp LEFT JOIN bioWell.bioPlate alj1 WHERE bioWell.bioPlate.name IS NULL ORDER BY name ASC
Hibernate is smart enough to match the 'bioWell.bioPlate' in the left join with the same in the where part. The generated SQL is (with Hibernate 3.2):
select .... from `BioMaterials` sampledata0_ left outer join `BioWells` biowelldat1_ on sampledata0_.`biowell_id`=biowelldat1_.`id` left outer join `BioPlates` bioplateda2_ on biowelldat1_.`bioplate_id`=bioplateda2_.`id` where sampledata0_.`discriminator`=2 and (bioplateda2_.`name` is null) order by sampledata0_.`name` ASC
With Hibernate 3.5 the following SQL is generated instead:
select .... from `BioMaterials` sampledata0_ left outer join `BioWells` biowelldat1_ on sampledata0_.`biowell_id`=biowelldat1_.`id` left outer join `BioPlates` bioplateda2_ on biowelldat1_.`bioplate_id`=bioplateda2_.`id` cross join `BioPlates` bioplateda4_ where sampledata0_.`discriminator`=2 and biowelldat1_.`bioplate_id`=bioplateda4_.`id` and (bioplateda4_.`name` is null) order by sampledata0_.`name` ASC
There is now an extra "cross join" to the BioPlates table and the query doesn't return the expected result.
The solution is probably to use the alias assigned to the left join in the restriction:
SELECT smp FROM SampleData smp LEFT JOIN bioWell.bioPlate alj1 WHERE alj1.name IS NULL ORDER BY name ASC
comment:8 by , 15 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
The old joining behavior was actually a Hibernate bug: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4091
comment:9 by , 15 years ago
comment:10 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Seems like the Hibernate developers are now working on this :)