[ 
https://issues.apache.org/jira/browse/TORQUE-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thomas Fox resolved TORQUE-291.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 4.1
    
> SetAndSave methods do not work for empty lists 
> -----------------------------------------------
>
>                 Key: TORQUE-291
>                 URL: https://issues.apache.org/jira/browse/TORQUE-291
>             Project: Torque
>          Issue Type: Bug
>          Components: Templates
>    Affects Versions: 4.0
>            Reporter: Thomas Fox
>            Assignee: Thomas Fox
>             Fix For: 4.1
>
>
> A setandSave method is called with an empty list.
> This generates an empty in clause in the executed sql, resulting in an sql 
> exception.
> Sample stacktrace for Derby:
> org.apache.torque.TorqueException: java.sql.SQLException: Syntax error: 
> Encountered ")" at line 1, column 181.
>       at 
> org.apache.torque.util.ExceptionMapperImpl.toTorqueException(ExceptionMapperImpl.java:59)
>       at org.apache.torque.util.BasePeerImpl.doSelect(BasePeerImpl.java:1068)
>       at org.apache.torque.util.BasePeerImpl.doSelect(BasePeerImpl.java:680)
>       at 
> org.apache.torque.test.peer.base.BaseNullableOIntegerFkPeer.doSelect(BaseNullableOIntegerFkPeer.java:305)
>       at 
> org.apache.torque.test.peer.base.BaseOIntegerPkPeerImpl.setAndSaveNullableOIntegerFks(BaseOIntegerPkPeerImpl.java:2898)
>       at 
> org.apache.torque.test.peer.base.BaseOIntegerPkPeerImpl.setAndSaveNullableOIntegerFks(BaseOIntegerPkPeerImpl.java:2830)
>       at 
> org.apache.torque.test.peer.base.BaseOIntegerPkPeer.setAndSaveNullableOIntegerFks(BaseOIntegerPkPeer.java:2068)
>       at 
> org.apache.torque.generated.peer.SetAndSaveTest.testSetAndSaveEmptyList(SetAndSaveTest.java:524)
>       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:592)
>       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.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
>       at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: java.sql.SQLException: Syntax error: Encountered ")" at line 1, 
> column 181.
>       at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.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.jdbc.Driver30.newEmbedPreparedStatement(Unknown 
> Source)
>       at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown 
> Source)
>       at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown 
> Source)
>       at 
> org.apache.commons.dbcp.cpdsadapter.PooledConnectionImpl.prepareStatement(PooledConnectionImpl.java:243)
>       at 
> org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.prepareStatement(ConnectionImpl.java:95)
>       at org.apache.torque.util.BasePeerImpl.doSelect(BasePeerImpl.java:979)
>       ... 24 more
> Caused by: ERROR 42X01: Syntax error: Encountered ")" at line 1, column 181.
>       at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>       at org.apache.derby.impl.sql.compile.ParserImpl.parseStatement(Unknown 
> Source)
>       at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>       at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>       at 
> org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown
>  Source)
>       ... 33 more

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscr...@db.apache.org
For additional commands, e-mail: torque-dev-h...@db.apache.org

Reply via email to