one to one(join column in right place) causes HQL eager fetch failure
---------------------------------------------------------------------
Key: HHH-4935
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4935
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.3.2
Environment: linux, windows, junit test with hibernate 3.3.4, 3.4 for
annotations/entityManager
Reporter: Dean Hiller
See the end of this post...
The test case and all code can be found in here....(just modified the Cat->Kitten
example till it broke)....
https://forum.hibernate.org/viewtopic.php?f=1&t=1002721&p=2425506...
basic summary though is if you have
SELECT s FROM Cat s inner join fetch s.kitten
and you redefine Cat->Kitten to be OneToOne, it works great if JoinColumn is on kitten,
but if you move JoinColumn to Cat, it results in a 1+N select where the first sql got all
the data needed by hibernate to fill in the Cats and their kitten. We have a 100 page
result set that is doing 1+N selects here.
ie. if you leave the join column on kitten, the following sql is 1+N then....
SELECT k FROM Kitten k inner join fetch k.cat; (ie. a more likely case since there may be
Cats without kitten, but a kitten always have a cat...that is the situation we have in our
object model).
so onetoone eager fetch joins only work on half the cases out there from what I can tell
and you get lucky if your join column is on the right object.
--
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