In a finder method...

SELECT Things.ID FROM Things, ThingCategory WHERE
ThingCategory.CategoryID='Animal';

Is that what you want??

Or do you want things which are also sub-categories of 'Animal'?  In
that case, you could enumerate the subcategories of animal, and then put
an 'OR' clause at the end of the SELECT.

-----Original Message-----
From: Peter Routtier-Wone <[EMAIL PROTECTED]>
To: JBoss-User <[EMAIL PROTECTED]>
Date: Friday, February 16, 2001 8:01 AM
Subject: Re: [jBoss-User] Recursive data structures


>> I also fail to understand why it is a problem.  How is recursive
>references
>> different to any other entity relationship?  Just store a PK, a
Handle,
>> whatever...
>
>In a schema I have a Category table related m:m to itself via a
Subcategory
>table, allowing the recursive construction of taxonomies of
indeterminate
>depth. This is the self-referential part (what I called a recursive
>structure).
>
>There is also a Thing table, and a ThingCategory table that allows
things to
>be assigned any number of classifications.
>
>It is possible for categories to apply to a thing indirectly by
implication
>of what might be described as taxonomic inheritance. (In fact the
taxonomy
>is potentially a network rather than an hierarchy, so there can be
multiple
>inheritance, but that is another matter.)
>
>Now an example of what's been bamboozling me.
>
>Suppose the taxonomy were of species; Butterfly would be a subclass of
>Insect, which in turn subclasses Animal, likewise Organic. Consider a
>particular butterfly called Jim, represented by a row in the Thing
table.
>
>We assert that Jim is a butterfly by creating a suitable row in the
>ThingCategory table. However, because Butterfly is a subcategory of
Insect
>(etc), by implication Jim is a member of the classes insect, animal and
>organic. Inheritance.
>
>Certainly it is possible to materialise the categories that apply by
>implication to Jim (or any other thing) but I am somewhat at a loss to
say
>how one might (efficiently) go about retrieving a set of Things that
are
>members of the category Animal.
>
>The problem, as I see it, is primarily one of inability on my part to
>express the above ideas in EJB terms. It is with the semantics of the
model
>that I most want help. On re-reading the EJB tome currently ballasting
my
>desk, I now suspect that this will be done with finder methods. I am in
the
>process of coding a utility class that does the recursive expansion of
>categories given a starting category, in order to succinctly express
the
>finder method.
>
>
>
>--
>--------------------------------------------------------------
>To subscribe:        [EMAIL PROTECTED]
>To unsubscribe:      [EMAIL PROTECTED]
>List Help?:          [EMAIL PROTECTED]



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to