-->
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: Trying to decide which mapping to use
PostPosted: Mon Jul 19, 2004 3:35 pm 
Newbie

Joined: Fri Oct 31, 2003 3:14 pm
Posts: 12
Location: New York, NY
Hello all,

I have the following Table structure:

USER{

user_id int PK
session_info varchar

}

PROFILE{

user_id int PK/FK
...

}

I have been trying to use one-to-one mappings, at first uni-directional from the User object, so that my Profile object didn't have a reference to the User object. But since I wanted Hibernate to handle the keys, I had to make it bi-directional. My problem now is I can't seem to have a NULL Profile in the User object.

Do I need to use a many-to-one to achieve this?

This seems like a very simple mapping, but the most logical mapping (one-to-one) doesn't seem to fit.

And advice would be greatly appreciated.

Thanks,
Patrick


Top
 Profile  
 
 Post subject: Re: Trying to decide which mapping to use
PostPosted: Mon Jul 19, 2004 4:08 pm 
Newbie

Joined: Fri Oct 31, 2003 3:14 pm
Posts: 12
Location: New York, NY
Ok, I think I have this working the way I want it to.

I was getting some odd "Null reference" things because Spring was Auto-Wiring my User object and giving it a Profile object that of course didn't have a reference back to the User object. I stop the Auto-Wiring and things appear to be working the way I want.

Well, except for the Profile object still needing the reference to User, but I can live with that.

Thanks,
Patrick


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.