UnsupportedOperationException caused by incorrect type of command created from
CommandGroup
-------------------------------------------------------------------------------------------
Key: TUSCANY-17
URL: http://issues.apache.org/jira/browse/TUSCANY-17
Project: Tuscany
Type: Bug
Components: Java DAS RDB
Environment: Windows XP Pro, Eclipse 3.2M4 , jdk 1.5, 1/23/2006 tuscany DAS
code stream. (build locally), Derby 10.1
Reporter: Ying Chen
This happens for "update", "delete", "insert" commands ...
I have the following entries in the config.xml
<Command name="updateCustomer" SQL="update CUSTOMERS set CUSTLASTNAME=?
CUSTFIRSTNAME=?, CUSTSTREETADDRESS=?, where CUSTOMERID=? " kind="update" />
<Command name="deleteCustomer" SQL="delete from CUSTOMERS where CUSTOMERID=?
" kind="delete" />
<Command name="insertCustomer" SQL="Insert INTO CUSTOMERS(CUSTOMERID,
CUSTLASTNAME, CUSTFIRSTNAME, CUSTSTREETADDRESS) VALUES(?, ?, ?, ?)"
kind="insert" />
When I do this in my code :
CommandGroup group =
CommandGroup.FACTORY.createCommandGroup(getMappingInputStream());
group.setConnection(getConnection());
Command update = group.getCommand("updateCustomer");
... // do some useful stuff here
update.execute();
update.execute() fails. This happens for the insert, update, and delete
commands (as much as I gone thru).
Tracing thru the code a bit - I noticed that the group.getCommand(str) - is
returning "ReadCommandImpl" .. my guess is that its expecting executeQuery()
to be called instead of execute().
Here is the stack trace :
java.lang.UnsupportedOperationException
at
org.apache.tuscany.das.rdb.impl.ReadCommandImpl.execute(ReadCommandImpl.java:76)
at
com.ibm.etools.sdo.das.tests.suites.UpdateTest.testUpdateConfigWithConnection(UpdateTest.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
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
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)
--
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