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: Determine which child table a record belongs to
Date Tue, 29 Jan 2008 18:28:14 GMT
This is a very common pattern in object-relational mapping. The column  
that contains the type of crane is commonly referred to as a  
discriminator column, and is commonly a CHAR, VARCHAR, or NUMERIC  
type. The value of the discriminator column that identifies which  
table to look for is referred to as a discriminator value.

The alternative is to include all possible tables in a query, which is  
performance-limiting.

Craig

On Jan 29, 2008, at 10:16 AM, MZ_TRICSTA wrote:

>
> Oh! I see. So I would need to add a "Type" column for all my parent  
> tables.
> That would definitely make things easier, but I was hoping there was  
> some
> SQL code that would magically give me the name of the child table.  
> Still,
> this will work fine. Thanks for all your help. ~Tricsta
>
>
> Brad Moore wrote:
>>
>> No problem.  Glad to be of help.
>>
>> If you have a CraneType column in the master table then you could use
>> that to determine which other table has associated data for that
>> Crane.  i.e. if CraneType = "ROUGHTERRAIN" then look in the
>> RoughTerrainCrane table.
>>
>> Brad
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Determine-which-child-table-a-record-belongs-to-tp15164998p15165775.html
> Sent from the Apache Derby Users mailing list archive at Nabble.com.
>

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