-->
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.  [ 5 posts ] 
Author Message
 Post subject: one-to-one like primary key
PostPosted: Thu Dec 04, 2003 2:04 pm 
Senior
Senior

Joined: Wed Sep 24, 2003 3:01 pm
Posts: 158
Location: Bragan�a Paulista - Brasil
Hi all,

I

_________________
Tads


Top
 Profile  
 
 Post subject: Re: one-to-one like primary key
PostPosted: Thu Dec 04, 2003 2:58 pm 
Senior
Senior

Joined: Wed Sep 24, 2003 3:01 pm
Posts: 158
Location: Bragan�a Paulista - Brasil
tads wrote:
Hi all,

I

_________________
Tads


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 3:59 pm 
Expert
Expert

Joined: Tue Sep 16, 2003 4:06 pm
Posts: 318
Location: St. Petersburg, Russia
Hello.
It is not clear what exactly does no work? The mapping looks Ok although I would reverse sides and make <one-to-one> element part of Company mapping, not MonthlyFee one...

If you need example with <one-to-one> mapping, take a look at http://www.hibernate.org/45.html


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 6:30 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Code:
<hibernate-mapping>
    <class name="Company" table="company">
      <id name="cnpj" column="cnpj">
         <generator class="assigned"/>
      </id>
        <property name="name" column="name"/>
      <property name="address" column="address"/>
      <one-to-one name="monthlyFee" class="MonthlyFee"
         constrained="false" outer-join="false"/>               
    </class>
</hibernate-mapping>


<hibernate-mapping>
    <class name="MonthlyFee" table="monthly_fee">               
        <id name="cnpj" column="cnpj">
           <generator class="foreign"/>
         </id>
        <one-to-one name="company" class="Company" constrained="true" outer-join="auto"/>
        <property name="value" column="valor"/>       
        <property name="dtPayment" column="date_m"/>       
    </class>
</hibernate-mapping>


Key one-to-one does not exist. the DTD is an essential part of the doc.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 05, 2003 6:22 am 
Senior
Senior

Joined: Wed Sep 24, 2003 3:01 pm
Posts: 158
Location: Bragan�a Paulista - Brasil
Thank you very much!!!

I know that the property key-one-to-one does not exists,
but, unfortunately, I did not find an example for this.

thanks again,

[]s

_________________
Tads


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.