-->
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.  [ 1 post ] 
Author Message
 Post subject: many-to-many question
PostPosted: Thu May 04, 2006 6:03 am 
Newbie

Joined: Thu May 04, 2006 5:18 am
Posts: 4
Location: Germany
Hello,

I have a question about a many-to-many association. I guess it will be the best to describe my question with an example.

I have one class containing al list object.

Code:
class MyList
{
private List<IAnimal> myAnimals = new List<IAnimal>();

public List<IAnimal> MyAnimals
{
get{ return myAnimals ; }
set{ myAnimals = value; }
}
}

and a second class representing (for example) a dog. This class implements the IAnimal interface that I want to use in the MyList-Class.

Code:
class Dog : IAnimal
{
private String name = "";

public String Name;
{
get{ return name; }
set{ name= value; }
}
}

In the MyList-Class I used the generic List<IAnimal> list to point out that I have a list, containing several object types (btw. I'm free to use any other "List-Type" if necessary)

I am new to NHibernate and all the examples (I have read so far) demonstrate a many-to-many accociation with a constant object-type. (At least that's how I understood the examples ;-) ).

My question is if it is possible to map such "multi-type-lists" with NHibernate and if the answer is yes, it would be great when someone could tell me how to do this :-).

I want to thank you for your answers.

SunX


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.