Can I ask for a bit of a sanity check here, please?


I have hibernate mappings built manually and functioning as follows:



For class LandUnit ...





&nbsp; &nbsp;&nbsp; &nbsp;<composite-id name="compId">

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<key-property name="loteId">

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<column name="LOTE_ID"/>

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</key-property>

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<key-property name="predioId">

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<column name="PREDIO_ID"/>

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</key-property>

&nbsp; &nbsp;&nbsp; &nbsp;</composite-id>

&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;

&nbsp; &nbsp; &nbsp; &nbsp; <set name="owners" 

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;table="cpe_propie_pred" 

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;order-by="titular_id" 

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;outer-join="auto" 

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lazy="true" 

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;inverse="false">

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <key foreign-key="predio_id">

&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<column 
name="LOTE_ID"/>

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <column 
name="predio_id"/>

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </key>

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <many-to-many 

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
&nbsp;class="mpm.persons.persistence_layer.Person"

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;column="titular_id" 

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp;foreign-key="titular_id"/>

&nbsp; &nbsp; &nbsp; &nbsp; </set>







... and for class Person ....







&nbsp; &nbsp;&nbsp; &nbsp;<id column="TITULAR_ID" 

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;name="titularId" 

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;type="java.lang.Long">

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<generator 
class="org.hibernate.id.TableHiLoGenerator">

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<param 
name="table">idgen</param> 

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<param 
name="column">NEXT</param>

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</generator>

&nbsp; &nbsp;&nbsp; &nbsp;</id>



&nbsp; &nbsp;&nbsp; &nbsp;<set&nbsp; &nbsp;name="properties" 

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;table="CPE_PROPIE_PRED"

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;inverse="false">

&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<key 
column="TITULAR_ID" />

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<many-to-many 

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
&nbsp;class="mpm.landregistry.persistence_layer.Predio"

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;unique="true">

&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<column 
name="LOTE_ID"/>

&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<column 
name="PREDIO_ID"/>

&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</many-to-many>

&nbsp; &nbsp;&nbsp; &nbsp;</set>







I can generate all of this from my diagram and, (as long as I edit the 
composite-id into the mapping), it works just as well as the manual original.



Is there a way to generate the composite key?



If I generate it, how can I get the many-to-many to refer to it correctly?



Changing to a different type of primary key structure is not feasable.



Thanks!
--
Regards,

Hasan
_________________________________________________________
Reply to the post : http://galaxy.andromda.org/forum/viewtopic.php?p=2193#2193
Posting to http://forum.andromda.org/ is preferred over posting to the mailing 
list!


-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP, 
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Andromda-user mailing list
Andromda-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/andromda-user

Reply via email to