-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: One-to-many with composite ID
PostPosted: Tue Nov 11, 2008 10:02 am 
Newbie

Joined: Tue Nov 11, 2008 9:23 am
Posts: 1
Hibernate version:3
Name and version of the database you are using:MySQL 5.0.27


Hi! I'm new to hibernate and I'm trying to create a parent-child relationship between two tables without any success.
The first table (Permisos) has a composite id.

These are the hibernate mapping:

Menu.hbm.xml

<hibernate-mapping>
<class name="abm.per.tables.Menu" table="menues">
<composite-id>
<key-property name="menu"/>
<key-property name="accion"/>
</composite-id>
<property name="descripcion"/>
<property name="orden"/>
<list name="permisos" cascade="all">
<key>
<column name="menu"></column>
<column name="accion"></column>
</key>
<index column="permiso"/>
<one-to-many class="abm.per.tables.Permiso"/>
</list>
</class>
</hibernate-mapping>

*************************************

Permiso.hbm.xml

<hibernate-mapping>
<class name="abm.per.tables.Permiso" table="permisos">
<composite-id>
<key-property name="tipoCliente"/>
<key-property name="menu"/>
<key-property name="accion"/>
</composite-id>
<property name="permiso"/>
</class>
</hibernate-mapping>

*****************************************

The menu bean class contains getter and setter methods for all attributes including
a List of permisos.

When I get a Menu Object, it fills the list of permisos with a PersistentList instead of a list of Permiso Object.
I don't know what I'm doing wrong, can anyone give me a little help!

much appreciated!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.