-->
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: Mapping-Problem with <set>
PostPosted: Tue Dec 27, 2005 4:28 am 
Newbie

Joined: Wed Sep 28, 2005 5:05 am
Posts: 11
Hi ;)
i´m using Hibernate 2.8.1 and MS SQLServer2005. I have two tables (a,b) with the relation 1:n.

In the mapping-file of table a i define a set wich references the foreign key of table b. Now comes the problem!!
The values in that foreign key are not the values from primary key of table a! This values are content of an other column in table a. That is the situation and i have to find a way to handle it, just with the mapping file, without changing structure of the database.
Does anybody have an idea...?

Greeings from Germany
Olli


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 27, 2005 5:25 am 
Beginner
Beginner

Joined: Thu Sep 01, 2005 7:43 am
Posts: 31
Location: León (Spain)
But what is keeping you from mapping the set as a normal relation? You won't be able to access the objects in the set programmatically? If you want the other column to appear as a key, maybe a composite key would work...

Bye.

_________________
Please rate...

Expert on Hibernate errors... I've had them all... :P


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 27, 2005 1:51 pm 
Regular
Regular

Joined: Wed Aug 25, 2004 7:40 pm
Posts: 65
A few of thoughts for your case:

1) can you keep the uniqueness quality of the foreign key if you use a non-primary key field of the table A as a foreign key refer field?

2) can you refer to the right parent object if you use a non-primary key field of the table A as a foreign key refer field?

3) why the primary key of the table A is not an option in your case?

A primary key of the table A is an object identification in the OO world. It shall be the parent object identification reference for all its children objects. Let's know the reason(s) you don't/can't use the primary key as foreign key.

Let me know whether the above helps or not.


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.