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.  [ 4 posts ] 
Author Message
 Post subject: Error with query using one-to-one
PostPosted: Tue Apr 20, 2004 1:14 pm 
Senior
Senior

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

_________________
Tads


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 20, 2004 1:24 pm 
Beginner
Beginner

Joined: Tue Apr 20, 2004 12:07 pm
Posts: 21
You are missing the mapping of the Company class.
Every class you intend to persist must be defined in one or more mapping files.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 20, 2004 1:31 pm 
Senior
Senior

Joined: Wed Sep 24, 2003 3:01 pm
Posts: 158
Location: Bragan�a Paulista - Brasil
Well, the mapping file of the Company is:

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"/>
      <property name="number" column="number"/>
      <property name="complement" column="complement"/>
      <property name="burgh" column="burgh"/>      
         <one-to-one name="monthlyFee" class="MonthlyFee"
            constrained="false" outer-join="false"/>         
    </class>
</hibernate-mapping>


Each Table or java bean contains its mapping file.

I didn

_________________
Tads


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 21, 2004 4:42 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Code:
<id name="company" column="cnpj">
and
private Company company;


So Hibernate use the Company object and serialize it to get the id.
What you want is probably add an extra id property.

_________________
Emmanuel


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