Mapping composite foreign key to composite primary key fails
------------------------------------------------------------
Key: HHH-5809
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5809
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.6
Environment: Java Hibernate 3.5.6_FINAL, Oracle 11g
Reporter: David
I am seeing a problem similiar to the problems described at:
https://forum.hibernate.org/viewtopic.php?f=25&t=996445
I have mapped a composite foreign key to a primary composite key and it does not cache the
results properly. It's a bi-directional, many-to-one association mapped essentially a
cut+paste (with variable name substitution) from:
http://docs.jboss.org/hibernate/annotations/3.5/reference/en/html/entity....
but with a @NotFound set to IGNORE.
When I include the relationship in an HQL left fetch join, I can see that the Child's
Parent entity is placed in the session-cache. But when the Child class's getParent()
method is invoked, the result is loaded from the database instead of the session. It
completely ignores the session and the second-level cache, so I'm left with the N + 1
problem. If I enable batch fetch (size = 8), the entities loaded from the batch are also
not placed into either session cache (or level 2), so I get 1 + N (8-batch) fetches.
If the query runs again, everything correctly loads from the second-level cache.
Thanks.
--
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