Hi Andy,

thanks for the hint.

Actually, prefixing the sequence name in the sequence definition
<sequence name="id_seq" datastore-sequence="DATASTOREIDENTITY8.DATASTORE_SEQ"/>
or specifying the schema to the package including the sequence
<package name="org.apache.jdo.tck.pc.shoppingcart" schema="DATASTOREIDENTITY8">
solves the problem.
I will use the schema definition on the package to fix this.

Chapter 18 XML Metadata of the spec defines that a schema declared at the jdo, orm, package, class or interface level, specifies the schema to be used as the default for tables contained therein. And if not specified the schema defaults to the PMF schema property (see end of page 221 and beginning of page 222 of the JDO 3.0 spec).

Do you see any issue, if the spec would define the same default for sequences? Then DataNucleus could take the PMF schema definition to prefix the sequence name the same way it currently does for all the table names.

Regards Michael

But the test cases fail, because it tries to create the sequence
included in the schema definition:
    Could not create new "sequence" DATASTORE_SEQ since autoCreate flags
do not allow it.

Any idea why the existing sequence is not used? I double-checked the
schema and the mapping metadata, but cannot find anything.
It is being used ... or at least trying to. Sadly when the statement
VALUES NEXT VALUE FOR DATASTORE_SEQ
is used to create a PreparedStatement, it throws an exception

07:43:42,677 (main) INFO  [DataNucleus.General] ->>  reserveBlock caught
exception
java.sql.SQLSyntaxErrorException: SEQUENCE 'DATASTORE_SEQ' does not exist.
         at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown
Source)
         at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown
Source)
         at
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
Source)
         at
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown
Source)
         at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown
Source)
         at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown
Source)
         at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown
Source)
         at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(Unknown
Source)
         at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(Unknown
Source)
         at org.apache.derby.impl.jdbc.EmbedPreparedStatement40.<init>(Unknown
Source)
         at org.apache.derby.jdbc.Driver40.newEmbedPreparedStatement(Unknown
Source)
         at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown
Source)
         at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown
Source)
         at
com.mchange.v2.c3p0.impl.NewProxyConnection.prepareStatement(NewProxyConnection.java:190)
         at
org.datanucleus.store.rdbms.SQLController.getStatementForQuery(SQLController.java:327)
         at
org.datanucleus.store.rdbms.SQLController.getStatementForQuery(SQLController.java:267)
         at
org.datanucleus.store.rdbms.valuegenerator.SequenceGenerator.reserveBlock(SequenceGenerator.java:135)
         at
org.datanucleus.store.valuegenerator.AbstractGenerator.reserveBlock(AbstractGenerator.java:305)
         at
org.datanucleus.store.rdbms.valuegenerator.AbstractRDBMSGenerator.obtainGenerationBlock(AbstractRDBMSGenerator.java:101)


So the question is why does Derby not allow that statement. Maybe you need to
prefix your schema name on the sequence name ?





--
*Michael Bouschen*
*Prokurist*

akquinet tech@spree GmbH
Bülowstr. 66, D-10783 Berlin

Fon:   +49 30 235 520-33
Fax:   +49 30 217 520-12
Email: [email protected]
Web: www.akquinet.de <http://www.akquinet.de>

akquinet tech@spree GmbH, Berlin
Geschäftsführung: Martin Weber, Dr. Torsten Fink
Amtsgericht Berlin-Charlottenburg HRB 86780 B
USt.-Id. Nr.: DE 225 964 680

--
*Michael Bouschen*
*Prokurist*

akquinet tech@spree GmbH
Bülowstr. 66, D-10783 Berlin

Fon:   +49 30 235 520-33
Fax:   +49 30 217 520-12
Email: [email protected]
Web: www.akquinet.de <http://www.akquinet.de>

akquinet tech@spree GmbH, Berlin
Geschäftsführung: Martin Weber, Dr. Torsten Fink
Amtsgericht Berlin-Charlottenburg HRB 86780 B
USt.-Id. Nr.: DE 225 964 680

Reply via email to