Hi Kevin

  My understanding is that we do not generate commands that include the ID
when it is a generated primary key of a table, also, if you want to force a
insert passing all fields you will loose any default column value especified
during table creation. I think what you really want is to create a empty
record with the appropriae primary key on the table, and I'm trying to do
some reserch if this is possible or not. If anyone have any ideas on how to
create a SQL command to create an empty record without specifying any values
to the columns (e.g NULL) please let us know.


--
Luciano Resende
http://people.apache.org/~lresende


---------- Forwarded message ----------
From: Kevin Williams (JIRA) <[email protected]>
Date: Dec 19, 2006 11:17 AM
Subject: [jira] Created: (TUSCANY-1007) ApplyChnages fails when added DO
does not include a modified property
To: [email protected]

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



--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to