cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lachlan Deck <>
Subject Re: Vertical inheritance
Date Thu, 03 Jun 2010 02:38:18 GMT
On 31/05/2010, at 11:11 PM, Andrus Adamchik wrote:

> Good thoughts. I really like the adaptive strategy idea, which can probably be used for
discriminator-free vertical mapping as well.

I'm not sure about this though: at what point would a user need to start adding the discriminator
to their historic data? How would they go about it? It sounds like you'd need to stick with
a strategy from the start.

(It certainly makes looking at data via sql easier with a discriminator too :)

> BTW, semantically "vertical inheritance with discriminator" is essentially single-table
inheritance with flattened attributes in subclasses. Which Cayenne supports already, but without
any special optimizations for wide|deep hierarchies.

>> On Mon, May 31, 2010 at 8:29 AM, Andrus Adamchik <> wrote:
>>> Great. this is the kind of feedback I was looking for :-)
>>> On May 31, 2010, at 8:17 AM, Mike Kienenberger wrote:
>>>> What you're suggesting could work, but we have at least one very deep
>>>> and wide inheritance tree in our current app, and the performance hit
>>>> of joining more than a hundred tables (so far) unnecessarily would
>>>> kill us.
>>> So how would you do a fetch based on discriminator column approach? I can
>>> think of a 2 step process:
>>> 1. Fetch ID's + discriminator columns from the root table.
>>> 2. Fully resolve objects, either doing joins only for the subset of tables
>>> that appeared in result in #1, or doing a separate query (without joins) for
>>> each subclass table matching the set of IDs.
>>> Does that sound right?


>>> Also I am sort of in favor of my original discriminator-free approach for
>>> smaller hierarchies, so wonder if a fetch strategy can be something
>>> specified for a given super-entity and/or query.

The discriminator-free approach sounds more complex to achieve for the initial cut though

with regards,

Lachlan Deck

View raw message