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.  [ 4 posts ] 
Author Message
 Post subject: many-to-one Inheritance Mapping - URGENT
PostPosted: Mon Aug 04, 2008 4:52 am 
Newbie

Joined: Tue Jul 29, 2008 5:19 pm
Posts: 3
I appreciate your help in this matter, as I am not able to find a solution for this using nhibernate; I am new to it anyway.

We do have an inheritance mapping problem where we have a Contact table, and an Customer table; where the Customer extends the Contact object; however, for the same Contact there can be multiple Customers (we do have some business case for this!). The Customer table has primary key column, and another column as foreign key column that references the Contact table.



The problem is that inheritance mapping using the joined-class looks to support one-to-one association/mapping between the base class and the derived class using the key element. Is there way to handle this case, any suggestion?

Again, appreciating your support and help

Thank you and Regards,

Ali


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 06, 2008 8:01 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
I'm not sure what you want to achieve, but for the inheritance mapping there can't be anything else than a one-to-one. But you should be able to map a customer collection on your contact object. What have you tried yet ?

_________________
--Wolfgang


Top
 Profile  
 
 Post subject: Re
PostPosted: Thu Aug 07, 2008 12:49 pm 
Newbie

Joined: Tue Jul 29, 2008 5:19 pm
Posts: 3
I have no problem with the one to many child relation. What i need to do is to have many class instances derived from a supper class. yet this does not look possible in hibernate.

Maybe the only solution is not to use inheritence and implement it as a containment.

Regards,


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 08, 2008 2:19 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Quote:
What i need to do is to have many class instances derived from a supper class.

You can't do that and it makes no sense if you're talking about OO and ORM. You may have a need for that, but you can't build that model with C# or JAVA either.

Quote:
Maybe the only solution is not to use inheritence and implement it as a containment.

That's what I meant with my post.

_________________
--Wolfgang


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.