dev@glassfish.java.net

Re: SQLAnyhwhere: Is it OK to "fake" a sequence?

From: Markus KARG <markus.karg_at_gmx.net>
Date: Wed, 10 Jan 2007 22:09:53 +0100

Lance, Marina,
> The SQL 2003 standard defines support for create sequence as well as
> identity columns
> SQL 2003 refers to Identity columns as internal sequence generator
> SQL 2003 refers to 'create sequence' as an external sequence generator
> Looking at the Persistence spec, I do not see what is the requirement
> WRT what should happen when you specify either
> @GeneratedValue(strategy=SEQUENCE/IDENTITY) and the specified strategy
> is not supported (perhaps i missed it). This looks like an area that
> should be clarified. So right now it looks to be implementation
> defined (again unless i missed this as i only scanned the Persistence
> spec).
> It sounds from Marina's comments below that a strategy of
> SEQUENCE/IDENTITY are treated the same given the current Toplink
> design. Marina please correct me if i am wrong.
> Given that the SQL Standard supports both forms of sequence
> generators, we should look at enhancing the code to support this as I
> suspect more databases will adopt support for IDENTITY and CREATE
> SEQUENCE ala PostgreSQL.
There is one more DBMS that provides both, IDENTITY and SEQUENCE: MaxDB.
I know that because, as you know, I am the author of the
MaxDBPlatform.java. :-)

In fact I am with Lance here, and I think Lance and I should file a
feature request. My understanding of the JPA specification is that that
it is up to the JPA user (programmer) to decide for a strategy, so
TopLink, as the reference implementation, should take respect of that
decision. TopLink should not decide to take other technology than
annotated, unless the strategy=AUTO (which explicitely allows TopLink to
be free to chose).

Lance, what do you think?

Markus