One-to-many associations inverse attribute in Hibernate mapping incorrect
-------------------------------------------------------------------------
Key: HIB-36
URL: http://team.andromda.org:8080/jira/browse/HIB-36
Project: Hibernate Cartridge
Type: Bug
Versions: 3.0M3
Environment: Linux 2.6.8, Mac OS X 10.3, and Windows XP Professional
Reporter: Chris Sterling
Assigned to: Martin West
We have an issue with one-to-many associations and how the Hibernate mapping
files get generated. Here is the relationship:
---------------- -------------------
- Order - 1 <>-----------------> * - OrderItem -
---------------- -------------------
In the Hibernate mapping file the following gets generated for the association
on each end:
Order.hbm.xml
<set name="order" order-by="ORDER_FK" lazy="false" inverse="true"
cascade="all-delete-orphan">
<key>
<column name="ORDER_FK"/>
</key>
<one-to-many class="foo.OrderImpl"/>
</set>
OrderItem.hbm.xml
<many-to-one name="order" class="com.dwango.cornerstone.role.OrderImpl" >
<column name="ORDER_FK"/>
</many-to-one>
The problem is in the first Hibernate mapping of Order. The attribute
"inverse=true" causes database errors when we load data through the
OrderImpl.setOrderItems(Collection) method and send it to the DAO
create(Order). We are using MySQL for our database and it does not persist the
data for the association collection. If the inverse attribute is change to
"false" then the association collection is persisted.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://team.andromda.org:8080/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Andromda-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/andromda-devel