-->
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.  [ 3 posts ] 
Author Message
 Post subject: one-to-one unidirectional mapping not working
PostPosted: Tue Nov 21, 2006 6:43 am 
Newbie

Joined: Tue Apr 25, 2006 2:08 am
Posts: 7
Hi All,

I have 2 objects. A Language Object and a User Object.

I want a one-to-one unidirectional mapping. The User has an instance of Language but not the other way around. So in short User knows about Language but NOT the other way around.

I want to map it like this:

<one-to-one
name="language"
class="test.Language"
cascade="none"
outer-join="auto"
constrained="false"
/>

This should be more than enough but when I re-create the database structure I can't find any evidence of any form of relation. The User table should have a column called abreviation (The name of the key of language) that is a reference to the language table.

I've seen solutions where people add a User object to the Language class but this is unacceptable. Language whould never ever know about User.

Is it true what I've read that Hibernate fails miserably when it come to one-to-ne unidirectional mapping?

Has anybody got a solution?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 21, 2006 7:01 am 
Regular
Regular

Joined: Tue Feb 24, 2004 11:42 am
Posts: 56
can you post the mapping files


Top
 Profile  
 
 Post subject: Found the solution
PostPosted: Tue Nov 21, 2006 2:40 pm 
Newbie

Joined: Tue Apr 25, 2006 2:08 am
Posts: 7
Hi All

I discovered that it was an error on my behalf. I was using an one-to-one relation when I should have used a many-to-one relation. I got everything up and running. Sorry if I wasted your time.

Martyn


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