Bi-directional, one-to-many, ordered lists don't work
-----------------------------------------------------
Key: HIB-129
URL:
http://jira.andromda.org/browse/HIB-129
Project: Hibernate Cartridge
Type: Bug
Versions: 3.1-RC1
Reporter: Joel Kozikowski
Assigned to: Carlos Cuenca
If defining a bi-directional, one-to-many association that is supposed to be an "ORDERED" list, the proper code to allow Hibernate to manage the index is not generated.
Discussed in this post (
http://galaxy.andromda.org/forum/viewtopic.php?p=3909#3909 ), the relevant information:
Per the Hibernate FAQ at
http://www.hibernate.org/193.html ....
Assume I've set the namespace property associationEndCollectionIndexName to the value of "listPosition".
If using Hibernate 2, the following additional code would need to be generated in the child entity's Java classes IF doing a bi-directional, one-to-many, ordered association:
Code:
private int listPosition;
public int getListPosition()
{
return this.get<nameOfParentEntity>().get<nameOfThisEntityInParent>().indexOf(this);
}
private void setListPosition(int index)
{
// not used, calculated value, see getIndex() method
}
Also, the "listPosition" attribute would need to be added to the child entity's Hibernate HBM file.
For Hibernate 3, the following change would be needed:
in the parent entity's HBM file, where the <list> mapping is, the "inverse" attribute should be set to FALSE (it is currently set to "true").
in the child entity's HBM file, where the <many-to-one> mapping is, the attributes "update" and "insert" both need to be set to false.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.andromda.org/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement *
http://www.sqe.com/bsce5sf
_______________________________________________
Andromda-devel mailing list
Andromda-devel@list...
https://lists.sourceforge.net/lists/listinfo/andromda-devel
opensubscriber is not affiliated with the authors of this message nor responsible for its content.