More info on this topic:


Two revealing posts from the Hibernate forum:



http://www.hibernate.org/193.html



and



(if you are using Hibernate 3):

http://forum.hibernate.org/viewtopic.php?t=945853&highlight=listindex



Also, I believe there is a bug in the "ordered list" feature of AndroMDA.  Some 
additional code needs to be generated.  Per the FAQ reference above (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 entity's Java classes IF doing a bi-directional association:







private int listPosition;



public int getListPosition()

  {

    return 
this.get<nameOfParentEntity>&#40;&#41;.get<nameOfThisEntityInParent>&#40;&#41;.indexOf&#40;this&#41;;

&nbsp; &#125;



&nbsp; private void setListPosition&#40;int index&#41;

&nbsp; &#123;

&nbsp; &nbsp; // not used, calculated value, see getIndex&#40;&#41; method

&nbsp; &#125;

&nbsp; ...







Also, the "listPosition" attribute would need to be added to the 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.



If I can figure out how to make a patch, I may submit the fix. Otherwise, can 
the person who works on the Hibernate cartridge make this fix?
_________________________________________________________
Reply to the post : http://galaxy.andromda.org/forum/viewtopic.php?p=3909#3909
Posting to http://forum.andromda.org/ is preferred over posting to the mailing 
list!


-------------------------------------------------------
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-user mailing list
Andromda-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/andromda-user

Reply via email to