-->
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: Inheritance question... what is the best way to handle this?
PostPosted: Thu Jan 01, 2009 9:07 pm 
Newbie

Joined: Thu Jan 01, 2009 9:01 pm
Posts: 2
I am just wondering how different people would handle the problem below.

I have a Thread table/class that contains multiple Posts. Each Thread and Post have an author, which is associated with a User object. However, there is a Member object that extends the User, to allow for anonymous/unregistered posting.

Now, lets say I want to use the following logic:

Code:
//pseudo-code

if (the post's author is a member, get its member object)
    do some stuff with the member object....

if (the post's author is not a member, get its user object)
    do some stuff with the user object....


What is the best way to handle this? I am mapping in Hibernate with the <joined-subclass> tag and it seems to be working fine otherwise. I can save members and users without problems.

Thank you in advance for your input!


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.