You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Török Péter <to...@Allround.net> on 2007/02/27 15:21:37 UTC

Must class qualifier be an entire field?

Hello,
is it necessary to have a full column reserved for the class qualifier in case of single table inheritance?
I.e. instead of qualifier
    personType = 'CUSTOMER'
would something like
    personType like 'C%'
work? Anyone tried such a thing yet?
Thanx in advance,
Péter
 

Re: Must class qualifier be an entire field?

Posted by Michael Gentry <bl...@gmail.com>.
I've not actually tried that, but I wouldn't really advise it if it
did work.  Could lead to unexpected problems down the road, such as
another personType starting with a "C", etc.  It might be interesting
to try it, though, just to see how it worked.  :-)

/dev/mrg


On 2/27/07, Török Péter <to...@allround.net> wrote:
>
>
> Hello,
> is it necessary to have a full column reserved for the class qualifier in
> case of single table inheritance?
> I.e. instead of qualifier
>     personType = 'CUSTOMER'
> would something like
>
>     personType like 'C%'
> work? Anyone tried such a thing yet?
> Thanx in advance,
> Péter
>

Re: Must class qualifier be an entire field?

Posted by Andrus Adamchik <an...@objectstyle.org>.
This works. But of course it is up to the programmer to ensure that  
the qualifier is built in such a way that multiple subclasses do not  
overlap.

Andrus


On Feb 27, 2007, at 4:24 PM, Mike Kienenberger wrote:

> I've not used single-table inheritance, but I'm pretty sure the
> qualifier is just a qualifier and completely independent of columns.
>
> It could be "0 = mod(random(), 2)" if the database supported the  
> functions.
>
> In this case, the fastest thing to do is to just test your  
> alternate qualifier.
>
> On 2/27/07, Török Péter <to...@allround.net> wrote:
>>
>>
>> Hello,
>> is it necessary to have a full column reserved for the class  
>> qualifier in
>> case of single table inheritance?
>> I.e. instead of qualifier
>>     personType = 'CUSTOMER'
>> would something like
>>
>>     personType like 'C%'
>> work? Anyone tried such a thing yet?
>> Thanx in advance,
>> Péter
>>
>


Re: Must class qualifier be an entire field?

Posted by Mike Kienenberger <mk...@gmail.com>.
I've not used single-table inheritance, but I'm pretty sure the
qualifier is just a qualifier and completely independent of columns.

It could be "0 = mod(random(), 2)" if the database supported the functions.

In this case, the fastest thing to do is to just test your alternate qualifier.

On 2/27/07, Török Péter <to...@allround.net> wrote:
>
>
> Hello,
> is it necessary to have a full column reserved for the class qualifier in
> case of single table inheritance?
> I.e. instead of qualifier
>     personType = 'CUSTOMER'
> would something like
>
>     personType like 'C%'
> work? Anyone tried such a thing yet?
> Thanx in advance,
> Péter
>