-->
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.  [ 1 post ] 
Author Message
 Post subject: Simple 1-to-n relation
PostPosted: Fri Apr 08, 2005 8:07 am 
Newbie

Joined: Fri Apr 08, 2005 7:52 am
Posts: 3
Hi,

I want to create a simple 1-to-n relation, which is not bidirectional. So I want to be able to the get the 1-side from the n-side, but not the other way round. As an example, I have a table of countries, and a table of addresses. Each address references a country. I want to easily access the country information from an address object. But I never need all addresses for a given country.

In fact, I want to reference the same country table from several different places (say from addresses, persons, products, ...).

When I create a simple many-to-one mapping in address:
...
<many-to-one name="country" class="Country" not-null="true"/>
...
but no corresponding <set> entry in country, I get an exception like then when trying to create the database schema:

org.hibernate.MappingException: An association from the table address refers to an unmapped class: Country

I am sure that what I want to achieve is very simple, but I just can not find the correct way to do it. Can someone please give me a hint where to look for a solution?

Thanks a lot,

Christoph Jäger

Hibernate version: Hibernate 3.0


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.