Hi All,
I'm trying to use the Hibernate cartridge which actually works quite good
for most of my classes. However there is one problem - how can I get
many-to-many relationships to generate correctly?
I tried it like this:
One Entity Class called User
One Entity Class called UserGroup
An association between these two, navigable in both directions and with a
"0..*" multiplicity on each end.
This gets generated without error messages. The resulting sections are:
In UserGroupImpl.hbm.xml:
<set name="user"
lazy="true"
access="property"
cascade="save-update"
table="USER_USERGROUP"
>
<key column="USERGROUP_TO_USER" not-null="false"/>
<many-to-many column="USER" class="com.dkaedv.jboard.entity.UserImpl"/>
</set>
In UserImpl.hbm.xml:
<set name="userGroup"
lazy="true"
access="property"
cascade="save-update"
table="USER_USERGROUP"
>
<key column="USER_TO_USERGROUP" not-null="false"/>
<many-to-many column="USERGROUP"
class="com.dkaedv.jboard.entity.UserGroupImpl"/>
</set>
What it does is that it creates a table with 4 columns:
USER_TO_USERGROUP
USERGROUP
USERGROUP_TO_USER
USER
IMHO there should be only 2 columns in this table and in one of the
Hibernate definitions it should state inverse=true.
Is there any way to get this to work? Should I use some stereotypes or
tagged values to achieve this?
Thanks in advance!
Daniel
P.S.: Thanks for your great work, guys! I especially like the seamless maven
integration.
--
View this message in context:
http://www.nabble.com/Many-To-Many-Relations-with-Hibernate-cartridge-tf3668533s17564.html#a10250172
Sent from the Fornax-Platform mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Fornax-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fornax-developer