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: How do you model your domain?
PostPosted: Fri Aug 11, 2006 2:03 pm 
Beginner
Beginner

Joined: Tue Dec 20, 2005 9:40 pm
Posts: 20
Hi,

I've written a few apps with NHibernate and I'm just wondering how others model their domain. One example I've had trouble with - which illustrates a larger question I have - is as follows:

I have an app in which users can listen to music. Each Album has a parent. A parent can either be an Artist or something more generic like Broadway Musical (if it's a compilation without an Artist). Since an Artist and Broadway Musical are very different, I decided to create an IAlbumParent interface which they would both implement. However, this creates problems with NHibernate since I have to use an any mapping for Album.Parent. This is a problem since there are a number of restictions on the things an any relationship can do. Moreover, the docs recommend such a relationship. So, how do others solve issues where classes implement an interface and should be treated as similar in a particular context.

A more common situation would be different kinds of products implementing an IProduct interface.

Of course, inheritance is a possibility, but is not always the best architecture.

Thanks for your thoughts.


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.