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: Interfaces, Polymorphism and the <any> mapping
PostPosted: Tue Aug 09, 2005 9:26 am 
Newbie

Joined: Mon Aug 08, 2005 11:09 am
Posts: 4
Hello,

I've been digging through the docs and forum for a while and could use some clarification on an issue. I have a situation where a single domain class may implement several interfaces. Its relationship to other domain classes is through those interfaces (e.g. class Car may implement both IVehicle and IAsset. The class CarPool has a reference to an IVehicle and the class AssetList has references to IAsset. these are just an example btw). Additionally, there are several classes implementing IVehicle and IAsset. I am having trouble figuring out how to define the mappings such that if I ask nHibernate to load an instance of CarPool, it loads any mapped IVehicle regardless of implementation type. Same for AssetList. I looked at the <any> mapping which seemed promising, however, the documentation says

Quote:
It is impossible to specify a foreign key constraint for this kind of association, so this is most certainly not meant as the usual way of mapping (polymorphic) associations. You should use this only in very special cases (eg. audit logs, user session data, etc).


Is there a more usual way to support this kind of mapping? I have not been able to find anything in the forum or docs.

Looking forward to your responses and thanx for your time.

Jay


Top
 Profile  
 
 Post subject: Re: Interfaces, Polymorphism and the <any> mapping
PostPosted: Wed Nov 09, 2005 8:43 am 
Did you find a solution, to define multiple interfaces in NHibernate configuration?

Regards, thomas


Top
  
 
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.