[ http://jira.andromda.org/browse/HIB-129?page=history ]
Joel Kozikowski updated HIB-129: -------------------------------- Attachment: bi-dir-ordered-list.patch HibernateMetafacadeModel.xml.zip Attached is DIFF file with corresponding Metafacde model to address this issue. > 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 > Assignee: Carlos Cuenca > Attachments: HibernateMetafacadeModel.xml.zip, bi-dir-ordered-list.patch > > 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. ------------------------------------------------------- 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