db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: Recursive Select for Discussion Forum
Date Thu, 01 Dec 2005 04:06:35 GMT
Hi Michael,

There are two different issues. The one I heard you start asking  
about is how to select all of the items in a thread. This can be done  
by selecting all items that match a discussion_id/thread id. The  
second is how to present them so their relationship to each other is  
clear. This can be done by making sure that there is a parent_id  
column that refers to the parent item and returning the parent_id in  
the selection. I don't see a requirement to perform your selection  
using parent_id.

Bottom line: use a thread_id column to select by; use a parent_id to  
render showing parent relationship.

Craig

On Nov 29, 2005, at 9:36 PM, Michael McCutcheon wrote:

> Daniel Noll wrote:
>
>> Michael McCutcheon wrote:
>>
>>> <snip>
>>> If not, are there any ways of handling scenarios like this  
>>> without having to do a select for each item?
>>
>>
>> I would have done this by having a discussion_id / thread_id column.
>>
>> A discussion generally has properties of its own, so in a full  
>> application you would presumably have a discussion or thread table  
>> already.  Selecting all messages in that discussion then becomes a  
>> trivial matter.
>>
>> Daniel
>>
> But then how do you maintain the hierarchy like javalobby?  i.e.:
>
> Topic Begin
>  |
>  response
>  response
>    |
>    response
>    |
>    response
>      |
>      response
>      response
>        |
>        response
>      |
>      response
>      response
>
>
> Don't you have to have a parent_id on each item?
>
> It seems like what you are suggesting is a 'flat' type of forum  
> (which I did not think about) where all items have the same parent  
> (for a top-level thread), and are shown sorted by date, not by  
> hierarchy.  Is that what you are suggesting?
>
> I'm really trying to emulate the behavior of javalobby.
>
> Thanks,
>
> Mike
>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
View raw message