-->
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: many-to-one problem.
PostPosted: Fri Aug 29, 2008 1:09 pm 
Newbie

Joined: Sun Apr 27, 2008 3:30 pm
Posts: 7
Hibernate version: HIbernate 3

Hi folks. For DP reasons I am going to give a like for like example of the problem I am seeing.

Say I have classes

Name (id_san, position_san)

and

Position (id_san, code)

Name is mapped with

<many-to-one
name="position"
class="model.Position"
cascade="none"
outer-join="true"
update="true"
insert="true"
column="position_san"
/>

Position has no reverse mappings. It only contains the primary key id property and the code property. Nothing else.

Now

I have an instance of Position (1000, 'A')

which I set to the name

name.setPosition(position)

and then save the name entity, the position_san is not being populated with the id of the Position, but if I make the association by hand by setting the position_san in the database and then fetch the Name then the Position comes out as well.

How can I get the position's id to save in position_san when I save the name? (including different mapping logic if I am doing this fundamentaly wrong)

thank you :)


Top
 Profile  
 
 Post subject: re
PostPosted: Sun Aug 31, 2008 6:46 am 
Newbie

Joined: Fri Aug 29, 2008 9:07 am
Posts: 16
Location: edinburgh/zielona gora
what's xml for second entity ? what for is outer-join?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 31, 2008 8:59 am 
Newbie

Joined: Sun Apr 27, 2008 3:30 pm
Posts: 7
I did not post the xml for the second entity because it contains nothing of importance. Only an id and a few properties. No relationships.

Chris


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.