-->
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.  [ 2 posts ] 
Author Message
 Post subject: key-many-to-one
PostPosted: Sat Apr 08, 2006 10:14 am 
Newbie

Joined: Sat Apr 08, 2006 10:09 am
Posts: 1
I have a table with only two columns, both are primary keys in other tables. I am trying to put many-to-one relations in my "table.hbm.xml" for both columns. Those two columns are the primary key in my table.
I have this in the hibernate mapping:

<class name="geofolksonomia.struts.entidad.Etiquetado" table="etiquetado">
<composite-id name="id" class="geofolksonomia.struts.entidad.EtiquetadoId">
<key-many-to-one name="codEtiqueta" type="geofolksonomia.struts.entidad.Etiqueta" column="codEtiqueta" />
<key-many-to-one name="codPostIt" type="geofolksonomia.struts.entidad.PostIt" column="codPostIt"/>
</composite-id>
</class>
The error is this: Attribute "type" must be declared for element type "key-many-to-one".



If I change the hibernate mapping to this:

<class name="geofolksonomia.struts.entidad.Etiquetado" table="etiquetado">
<composite-id name="id" class="geofolksonomia.struts.entidad.EtiquetadoId">
<key-many-to-one name="codEtiqueta">
<type name="geofolksonomia.struts.entidad.Etiqueta"/>
<column name="codEtiqueta" />
</key-many-to-one>
<key-many-to-one name="codPostIt">
<type name="geofolksonomia.struts.entidad.PostIt"/>
<column name="codPostIt"/>
</key-many-to-one>
</composite-id>
</class>


I get this error:
The content of element type "key-many-to-one" must match "(meta*,column*)"

I am using Hibernate 3 and MySql 5.0

Can anyone help me?
Sorry about my english.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 08, 2006 12:15 pm 
Newbie

Joined: Wed Nov 30, 2005 4:13 pm
Posts: 12
I don't know what is wrong with attribute type case, but
in second case you have to add column element as content of type element

Code:
<class name="geofolksonomia.struts.entidad.Etiquetado" table="etiquetado">
<composite-id name="id" class="geofolksonomia.struts.entidad.EtiquetadoId">
<key-many-to-one name="codEtiqueta">
<type name="geofolksonomia.struts.entidad.Etiqueta">
<column name="codEtiqueta" />
</type>
</key-many-to-one>
<key-many-to-one name="codPostIt">
<type name="geofolksonomia.struts.entidad.PostIt">
<column name="codPostIt"/>
</type>
</key-many-to-one>
</composite-id>
</class>


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

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.