db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Jefferson <a...@jpox.org>
Subject Re: Datastore identity strategy
Date Wed, 29 Mar 2006 06:33:25 GMT
Hi Craig,

> Using both identity and sequence makes sense for schema generation 
> where you want the identity strategy (JDO implementation doesn't 
> generate key values) and automatic key generation using the sequence 
> named (JDO implementation generates the trigger and stored procedure
> to use the named sequence).

JPOX doesn't support creation of trigger/storedproc for using sequences like this
currently.
We could just retrieve the value from the sequence and use that in the INSERT
(which is what we do with strategy="sequence" anyway). Whether the JDO impl uses
triggers/storedprocs is its decision isn't it ? How would a TCK be able to check
what the impl was doing ? ;-)

>> So how do you specify MySQL "autoincrement" if you remove this ?  
>> They aren't "IDENTITY" type.
>
> It seems that the functionality is identical to IDENTITY as defined  
> by SQL 2003.

Internally JPOX treats "identity" and "autoassign" identically, so this part
would actually simplify things slightly for us, and causes no issue that I know of.



> I'd say strategy="identity" with no sequence means use the  
> GENERATED ... AS IDENTITY.

Yes, or "autoincrement", or probably "SERIAL" too.

> strategy="identity" with sequence also specified means use a trigger  
> and stored procedure to generate key values.

Yes, but with my comments above.

> strategy="sequence" means use the named sequence explicitly in insert  
statements, as in INSERT INTO EMPLOYEE (ID, NAME) VALUES 
(named_sequence.nextval, ?).

Yes, although the implementation needs to know the value being used so would
likely do the "nextval" call first and plug the value into the INSERT.


--
Andy

Mime
View raw message