-->
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: Can I map this relationship in Hibernate?
PostPosted: Tue Feb 22, 2005 5:21 am 
Newbie

Joined: Tue Feb 15, 2005 12:10 pm
Posts: 4
Hibernate version: 2

I have a table that relates to either one of 2 other tables. There is a column in the table that indicates which one of the two to relate to.
For example.
I have 3 tables:
Table1
Table2
Table3

Table 1 contains a column called relateTo which contains one of the following two values:
Table2
Table3

The column relate2 indicates which table the record in Table1 should map to.

Is there any way of mapping this in Hibernate?
Thank You.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 22, 2005 11:16 am 
Regular
Regular

Joined: Wed Nov 17, 2004 11:49 am
Posts: 65
Location: Pittsburgh
I don't think this mapping is supported directly, and without knowing what you are trying to do from an object stand point, it's difficult to suggest alternatives. From what I understand of your question, I would suggest looking into the table per subclass mapping strategy for an example of how you might want to reorganize your schema. One problem with the schema you describe is that it lacks referential integrity.


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.