-->
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: Map a col. of the one-to-many table to a property of 'one'
PostPosted: Tue Mar 15, 2005 5:12 pm 
Beginner
Beginner

Joined: Sat Oct 18, 2003 8:00 pm
Posts: 22
I'm using 3.0rc1

I have an association:

Users(1)----*Properties*------(1)System


The system-> property relation are working fine.

For user table to property table I have a users_properties table, which holds a value column. How I make the property object get the value of the relation (1-n) table users_properties?

mappings:

translation :) :
user=usuario
system=sistema
property=propriedade

<class name="gov.tresc.admsist.model.Usuario" table="USUARIO"
schema="ADMSIST">
<id name="id" column="IDO_USUARIO" type="long" unsaved-value="null">
<generator class="sequence">
<param name="sequence">GET_ID_USUARIO</param>
</generator>
</id>
<property name="nome" column="NOME_USUARIO" type="string"
not-null="true" />
<property name="login" column="LOGIN" type="string"
not-null="true" />
<property name="email" column="E_MAIL" type="string"
not-null="true" />

<set name="sistemas" table="USUARIO_SISTEMA">
<key column="IDO_USUARIO"/>
<many-to-many column="IDO_SISTEMA"
class="gov.tresc.admsist.model.Sistema"/>
</set>

<set name="propriedades" table="USUARIO_PROPRIEDADE">
<key column="IDO_USUARIO"/>
<one-to-many column="IDO_PROPRIEDADE"
class="gov.tresc.admsist.model.Propriedade"/>
</set>

</class>

<hibernate-mapping>
<class name="gov.tresc.admsist.model.Propriedade" table="PROPRIEDADE"
schema="ADMSIST">
<id name="id" column="IDO_PROPRIEDADE" type="long" unsaved-value="null">
<generator class="increment"/>
</id>
<property name="nomePropriedade" column="NOME_PROPRIEDADE" type="string"
not-null="true" />
</class>
</hibernate-mapping>

Thanks
Emerson


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 15, 2005 5:26 pm 
Beginner
Beginner

Joined: Sat Oct 18, 2003 8:00 pm
Posts: 22
maybe I was not clear:

I have a Property table and a User table.
Thinking in this way, it's a N-M relationship.

Those are connected through a USER_PROPERTY table, which holds a value column. How can I get the value comumn to be mapped to the property class?

thanks for the help
Emerson


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.