db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanley Bradbury <Stan.Bradb...@gmail.com>
Subject Re: Identity/Sequence
Date Fri, 16 Jun 2006 17:51:52 GMT
Diego Cattelan wrote:
> Hi, i'm investigating on using derby for some new project i'll start 
> next week, but i'm facing in some trouble/misunderstanding of  derby 
> identity.
>
> If i declare a column as
>
>  ... GENERATED ALWAYS AS IDENTITY
>
> derby fills it correctly with an increasing value.
>
> My problem is:
> in my application logic i will obviously reuse previous-projects 
> libraries in wich sometimes i use two tables sharing the same 
> generator/sequence. In Oracle,PostgreSQL and Firebird i do something like
>
> <pseudocode>
>
> create sequence asequence starting with 1;
>
> create table tableA(
> ...
>     id integer GENERATED ALWAYS AS IDENTITY BY asequence,
> ...)
>
> create table tableB(
> ...
>     id integer GENERATED ALWAYS AS IDENTITY BY asequence,
> ...)
> </pseudocode>
>
> i need to do the same with derby, but how can i do that ?
>
> Tanks
>
>
Hi -

Derby does not currently support Sequences.  There is an unassigned 
feature request to add this functionality. 
*DERBY-712 <http://issues.apache.org/jira/browse/DERBY-712> (  
*http://issues.apache.org/jira/browse/DERBY-712 )

The only way I can think of to do this in the current system would be by 
defining a java function to assign and manage numeric sequences.

HTH


Mime
View raw message