-->
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: many-to-one association to a component?
PostPosted: Thu Jan 20, 2005 12:52 pm 
Newbie

Joined: Thu Jan 20, 2005 12:05 pm
Posts: 2
Hi,

I have an object model that looks like: Person->A->*B. However I have only two tables: Person, and B, with B having a foreign key pointing back to Person.

So, object A's attributes reside inside the Person table. Therefore I'm making A a component of Person.

Now I would like to form a bidirectional relationship between objects A and B (one-to-many). That would force B's mapping file to reference A, which is a component.

1. The component mapping for A looks like:

<component
name="a"
class="*.*.*.A">

....
<set
name="setOfBs"
lazy="false"
inverse="true"
cascade="all">
<key column="PERSON_ID" />
<one-to-many class="*.*.*.B" />
</set>
.....
</component>

2. B's mapping looks like:
...
<many-to-one
name="a"
class="*.*.*.A"
column="PERSON_ID"
not-null="true"
insert="true"
update="false"
/>
...

Now when I try to test this, I get:

"An association from the table B refers to an unmapped class: *.*.*.A"

Please advise as for how I can make this right?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 20, 2005 5:10 pm 
Regular
Regular

Joined: Tue Jun 22, 2004 8:01 pm
Posts: 106
Location: PowderTown, Utah, USA
You can't map to components using the many-to-one or one-to-many. Components are different from entities and have their own mapping notation. To see how to map components, or how to map to a collection of components see:

http://www.hibernate.org/hib_docs/refer ... components


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.