The previous response had some junk at the end that I meant to delete ...
Brent,
It looks like I have not been thinking this all the way through. Since
you have fixed the case where a generated key column is present then
lets consider the case where one is not. It seems our choices here are
to either throw an exception -- this is likely an error condition -- or
to attempt an empty INSERT since that is what we are being asked to do.
What do you think?
--
Kevin
Brent Daniel (JIRA) wrote:
[
http://issues.apache.org/jira/browse/TUSCANY-1007?page=comments#action_12459812
] Brent Daniel commented on TUSCANY-1007:
---------------------------------------
Kevin,
I'm not sure what behavior you want here. The ID column in your test
case is not a generated column. How do you want the DAS to pick an ID
value? The issue with doing an empty insert with a generated ID
column was fixed in tuscany-957.
ApplyChnages fails when added DO does not include a modified property
---------------------------------------------------------------------
Key: TUSCANY-1007
URL: http://issues.apache.org/jira/browse/TUSCANY-1007
Project: Tuscany
Issue Type: Bug
Reporter: Kevin Williams
Looks like the generated insert is invalid when the change history
for an added DO does not include a modified property. I think the
correct behavior should be to generate an ID-only INSERT. An
alternative would be to generate an INSERT that initializes all
columns ... i'd be interested in hearing arguments to justify the
latter.
This test:
/das/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.testReadInsertApply()
demonstrates the problem. I have temporarily commented it out.
Here is the stack trace:
java.lang.RuntimeException: SQL Exception: Column 'ID' cannot
accept a NULL value.
at
org.apache.tuscany.das.rdb.impl.InsertCommandImpl.execute(InsertCommandImpl.java:47)
at
org.apache.tuscany.das.rdb.impl.ChangeOperation.execute(ChangeOperation.java:73)
at org.apache.tuscany.das.rdb.impl.Changes.execute(Changes.java:57)
at
org.apache.tuscany.das.rdb.impl.ApplyChangesCommandImpl.execute(ApplyChangesCommandImpl.java:69)
at
org.apache.tuscany.das.rdb.impl.DASImpl.applyChanges(DASImpl.java:244)
at
org.apache.tuscany.das.rdb.test.CrudWithChangeHistory.testReadInsertApply(CrudWithChangeHistory.java:289)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.extensions.TestSetup.run(TestSetup.java:23)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: SQL Exception: Column 'ID' cannot accept a NULL value.
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.EmbedStatement.executeStatement(Unknown
Source)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown
Source)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown
Source)
at
org.apache.tuscany.das.rdb.impl.Statement.executeUpdate(Statement.java:173)
at
org.apache.tuscany.das.rdb.impl.Statement.executeUpdate(Statement.java:133)
at
org.apache.tuscany.das.rdb.impl.InsertCommandImpl.execute(InsertCommandImpl.java:44)
... 28 more
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]