-->
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: Object relationship without referential integrity constraint
PostPosted: Thu Sep 10, 2009 6:11 am 
Newbie

Joined: Thu Sep 10, 2009 6:03 am
Posts: 1
Is it possible with Hibernate to associate 2 java objects but still there is no relationship between the two entities in database? If yes, then please point me to appropriate references on how to do this.

In my case I have got a "location" entity which I want to be common for "Users" & "Contacts" in my application. For this one option that comes to my mind is to have unidirectional many-to-one relationship between "User" & "Location" and "Contact" & "Location". I am looking for an option in which these is no RI constraint between tables and yet I achieve cascading between my objects


Top
 Profile  
 
 Post subject: Re: Object relationship without referential integrity constraint
PostPosted: Thu Sep 10, 2009 9:01 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Unfortunately, you're going to need some type of foreign key. You may not need the actual constraint, but a key pointing to the other table must be there.

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


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.