-->
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: Composite keys problem
PostPosted: Tue Jan 24, 2006 2:03 pm 
Newbie

Joined: Thu Jan 12, 2006 9:41 am
Posts: 15
Location: France
Hi!

I'm using Hibernate tools for reverse engineer the schema database.
I have a problem with the code generated.


<class name="A" table="A">
<composite-id name="id" class="AComposite">
<key-many-to-one name="b" class="B">
<column name="idB"/>
</key-many-to-one>
<key-property name="titi">
<column name="TITI"/>
</key-property>
</composite-id>

<property name="nameofproperty1">
<column name="PROPERTY1" />
</property>
<property name="nameofproperty2">
<column name="PROPERTY2" />
</property>
</class>


<class name="B" table="B">
<set name="As" inverse="true">
<key>
<column name="idA"/>
</key>
<one-to-many class="A" />
</set>
</class>

The hibernate-tools generates my POJOs from the hbm.xml and create 2 classes:
-AId which contains
- idB
- titi
+ getter/setter
-A which contains
- AId id
- B b
- nameofproperty1
- nameofproperty2
+ getter/setter

When I run the unit test, an error occurred:
"Could not find a getter for b in class AId"

Why should I add a getter for b?
Does it generate badly?


I don't understand.

Help!

Tim[code][/code]


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 26, 2006 2:29 pm 
Newbie

Joined: Thu Jan 12, 2006 9:41 am
Posts: 15
Location: France
Yes! I found the solution! The problem was caused by a modification of database schema.

Tim :o)


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.