Uploaded image for project: 'Torque'
  1. Torque
  2. TORQUE-291

SetAndSave methods do not work for empty lists

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.0
    • 5.0
    • Templates
    • None

    Description

      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

      Attachments

        Activity

          People

            tfischer Thomas Fox
            tfischer Thomas Fox
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: