Thanks very much Andrus for clearing that out!
Final question;
Which approach would you recommend for DB-independent design? I mean
Generated vs AUTO_PK_SUPPORT ? (I guess "Generated" will have better
performance than AUTO_PK_SUPPORT)
If "Generated" is used and DB doesn't support sequences, will Cayenne
automatically use AUTO_PK_SUPPORT ?
Thank you!
Roman.
Andrus Adamchik wrote:
> Didn't realize you are using 1.2 that adds support for auto-incrementing
> pk columns... Thought you are still on 1.1. Good thing is that as far as
> Cayenne app DB transparency is concerned, this doesn't change a thing -
> if you mark PK columns as "generated", Cayenne will automatically
> default to "auto increment" on MySQL, and fall back to sequences on
> Oracle. Nothing special is needed for this to happen.
>
> Now, if you want to INSERT records from non-Cayenne
> applications/scripts, you have to choose some mechanism that works for
> you, as generally there is no universal "standard" for PK generation and
> on every DB you have a number of reasonable choices. I guess you'll have
> to settle on some least common denominator approach and let Cayenne use
> it. If this approach happens to be the one already supported by Cayenne
> (such as "AUTO_PK_SUPPORT" table), you'll minimize your effort in making
> Cayenne compatible, but will need to make sure others follow the rules.
> Otherwise you'll have to implement your own PkGenerator (or subclass an
> existing one), which is fairly trivial.
>
> Andrus
>
>
>
> On Feb 23, 2005, at 3:48 PM, Roman D wrote:
>
>> Thanks Andrus,
>>
>> To put in the practical way; Let's say I'm developing application with
>> Mysql, then I deploy it to production server running Oracle.
>> I can't use "Cayenne Generated Primary Key" because database structure
>> will be diffrent on difrent DB types -on mysql column type will have
>> auto_increment and on Oracle it will have an additional sequence.
>>
>> Okay, then I should use "Generate Primary Key Support" (chapter 4.6).
>> It seems like DB-independent, using an additional special
>> "AUTO_PK_SUPPORT" sequence table[s].
>> It's okay but what if I need to access same database from non-Cayenne
>> solution or non-Java, like perl? (Though I can teach perl script to
>> use "AUTO_PK_SUPPORT" but that's out of scope).
>>
>> What is the best practice to have database structure which is
>> completely free of DB-specific features (e.g. not using mysql
>> auto_increment or Oracle sequence) and is it possible without having
>> Cayenne-specific "AUTO_PK_SUPPORT" tables?
>>
>> Thanks,
>> Roman.
>
>
>
This archive was generated by hypermail 2.0.0 : Wed Feb 23 2005 - 20:37:17 EST