Message:
The following issue has been closed.
Resolver: Gavin King
Date: Fri, 28 Nov 2003 7:27 PM
PLease redirect this issue to the user forum, and provide sufficient info (esp. mapping documents). This is certainly not a bug in Hibernate (we have a test suite).
---------------------------------------------------------------------
View the issue:
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-507
Here is an overview of the issue:
---------------------------------------------------------------------
Key: HB-507
Summary: session.save() does not create records in child table for composite ids
Type: Bug
Status: Closed
Priority: Major
Resolution: REJECTED
Project: Hibernate2
Versions:
2.1 beta 4
Assignee:
Reporter: Mikheil Kapanadze
Created: Fri, 28 Nov 2003 8:54 AM
Updated: Fri, 28 Nov 2003 7:27 PM
Description:
We have 2 persistent object, Highlight and HighlightLinks. Highlight object has one-to-many association to HighlightLinks with cascade="all", while the second one has composite id
<composite-id>
<key-many-to-one name="highlight" class="Highlight" column="HIGHLIGHT_ID"/>
<key-property name="offset" column="OFFSET" type="int"/>
</composite-id>
HighlightLinks object implements java.io.Serializable interface and equals()/hashCode() methods.
The code looks like:
Highlight highlight = new Highlight();
//Some setX() methods on highlight
highlight.setLinks(new HashSet());
HighlightLinks link = new HighlightLinks();
link.setOffset(linkItem.getIndex());
link.setHighlight(highlight);
//Some other setX() methods on link
highlight.getLinks().add(link);
//Some stuff here
session.save(highlight);
After this, the new record appears in HIGHLIGHT table, while HIGHLIGHT_LINK is empty.
As we can see from logs (show_sql is turned on), Hibernate is trying to update HIGHLIGHT_LINK table instead of inserting there.
We checked this issue on Hibernate 2.0.1 - it works (initially code was developed for this version). We found this issue in 2.1 beta 4.
We also checked out the latest code from CVS and the problem seems to still exist.
Thanks,
Mikheil
---------------------------------------------------------------------
JIRA INFORMATION:
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.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|