On Aug 9, 2011, at 1:31 PM, Michael Bouschen wrote:
Hi Andy,
I looked at the datastoreidentity "detach" test.
The test uses the PersistenceCapable classes from the shoppingcart
package. They are mapped using the "increment" strategy:
<datastore-identity strategy="increment" column="DATASTORE_ID"/>
Is it possible that DataNucleus recently changed the implementation
of the "increment" strategy? The test was working before without an
additional sequence table.
Here is what the spec says about the "increment" strategy:
The value "increment" specifies a strategy that simply finds the
largest key already in the database and increments the key value for
new instances. It can be used with integral column types when the
JDO application is the only database user inserting new instances.
I have the feeling the intention of the "increment" strategy is the
case where the JDO implementation keeps track of the keys and
internally calculates the next value. So I'm wondering whether
mapping this to a sequence table is OK.
What do you think?
The intent of the "increment" strategy is to allow use of a database
that the user has no control over (for example, the DBA refuses to add
new tables). It's not an optimal strategy but a useful one. The JDO
implementation can cache the largest key used and mitigate database
access for each insert.
But without changing the specification, I don't think it's ok to
require another table in order to implement "increment". That's what
"sequence" is for.
Was there a recent change in DataNucleus that now "increment" is
implemented using an internal "sequence" strategy?
Craig
Regards Michael
Hi Andy,
thanks for the info!
After removing my local maven repository (~/.m2/repository) I see
the same results. I have no idea what caused the difference,
especially because I had more errors and failures in other
testcases. They are all gone away. I will take a closer look at
the datastoreidentity "detach" test.
Regards Michael
I run the test as you proposed and there is one configuration
failing:
companyPMInterface (for application- and datastoreidentity).
The configurations runs the completeness test with basis mapping
(meaning schema) using PersistenceCapable interfaces where the
implementation is created by the PM. The test fails with the
following
exception:
NucleusDataStoreException: Add request failed : INSERT INTO
APPLICATIONIDENTITY0.PROJECT_MEMBER (PROJID,"MEMBER") VALUES (?,?)
with an nested exception:
SQLException: Only executeBatch and clearBatch allowed in the
middle
of a batch.
Is this the failure you meant or is this a separate issue?
Hi Michael,
I get no such failure. I simply turn off autoCreateTables from
jdori-pmf then
mvn clean install
so have a clean DB and get the following from datastoreidentity
"detach" test
There were 18 errors:
1)
testNullTransientAndUndetachableIsDetachedFalse
(org
.apache.jdo.tck.api.jdohelper.IsDetached)javax.jdo.JDOUserException:
Could not create "increment"/"table" value-generation container
DATASTOREIDENTITY8.SEQUENCE_TABLE since autoCreate flags do not
allow it.
at
org
.datanucleus
.api
.jdo
.NucleusJDOHelper
.getJDOExceptionForNucleusException(NucleusJDOHelper.java:520)
at
org
.datanucleus
.api
.jdo
.JDOPersistenceManager
.jdoMakePersistent(JDOPersistenceManager.java:739)
at
org
.datanucleus
.api
.jdo
.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:
759)
at
org
.apache
.jdo
.tck
.api
.persistencemanager.detach.DetachTest.localSetUp(DetachTest.java:79)
at org.apache.jdo.tck.JDO_Test.setUp(JDO_Test.java:255)
at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:271)
at
org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java:
108)
at
org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:
148)
at
org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:
123)
NestedThrowablesStackTrace:
Could not create "increment"/"table" value-generation container
DATASTOREIDENTITY8.SEQUENCE_TABLE since autoCreate flags do not
allow it.
org.datanucleus.exceptions.NucleusUserException: Could not create
"increment"/"table" value-generation container
DATASTOREIDENTITY8.SEQUENCE_TABLE since autoCreate flags do not
allow it.
at
org
.datanucleus
.store
.rdbms
.valuegenerator
.TableGenerator.createRepository(TableGenerator.java:261)
at
org
.datanucleus
.store
.rdbms
.valuegenerator
.AbstractRDBMSGenerator
.obtainGenerationBlock(AbstractRDBMSGenerator.java:162)
at
org
.datanucleus
.store
.valuegenerator
.AbstractGenerator.obtainGenerationBlock(AbstractGenerator.java:197)
at
org
.datanucleus
.store
.valuegenerator.AbstractGenerator.next(AbstractGenerator.java:105)
at
org
.datanucleus
.store
.rdbms
.RDBMSStoreManager
.getStrategyValueForGenerator(RDBMSStoreManager.java:1219)
at
org
.datanucleus
.store
.AbstractStoreManager.getStrategyValue(AbstractStoreManager.java:
1514)
at
org
.datanucleus.ObjectManagerImpl.newObjectId(ObjectManagerImpl.java:
3381)
at
org
.datanucleus
.state.JDOStateManagerImpl.setIdentity(JDOStateManagerImpl.java:835)
at
org
.datanucleus
.state
.JDOStateManagerImpl
.initialiseForPersistentNew(JDOStateManagerImpl.java:428)
at
org
.datanucleus
.state
.ObjectProviderFactory
.newForPersistentNew(ObjectProviderFactory.java:163)
at
org
.datanucleus
.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.java:
1778)
at
org
.datanucleus
.ObjectManagerImpl.persistObjectWork(ObjectManagerImpl.java:1627)
at
org
.datanucleus
.ObjectManagerImpl.persistObject(ObjectManagerImpl.java:1474)
at
org
.datanucleus
.api
.jdo
.JDOPersistenceManager
.jdoMakePersistent(JDOPersistenceManager.java:734)
at
org
.datanucleus
.api
.jdo
.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:
759)
at
org
.apache
.jdo
.tck
.api
.persistencemanager.detach.DetachTest.localSetUp(DetachTest.java:79)
at org.apache.jdo.tck.JDO_Test.setUp(JDO_Test.java:255)
at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:271)
at
org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java:
108)
at
org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:
148)
at
org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:
123)
i.e there is a component of schema missing from the config files
and you are
prohibited from creating it without that persistence property.
Consequently
that property was turned on (unless you wanted to add the schema for
DATASTOREIDENTITY8.SEQUENCE_TABLE).
No other tests fail.
--
*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
Craig L Russell
Architect, Oracle
http://db.apache.org/jdo
408 276-5638 mailto:[email protected]
P.S. A good JDO? O, Gasp!