Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-3981

Statement caching in update query which return value

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Minor Minor
    • No Release
    • JBossAS-4.0.5.GA
    • JCA service
    • None
    • jboss 4.0.5 on windows xp / linux with database oracle 10.0.2

      When I set statements cache in oracle-xa-ds.xml:
      <prepared-statement-cache-size>100</prepared-statement-cache-size>

      For the following statement:

      BEGIN
      UPDATE table SET A=? WHERE ID=? AND TIME=? RETURNING TIME INTO ?;
      END

      con = DataSourceManager.getConnection();
      statement = con.prepareCall( 'The above query');
      statement.setInt(1,1);
      statement.setTimestamp(2, myTime);
      statement.registerOutParameter(3, Types.TIMESTAMP);
      statement.executeUpdate();
      final Timestamp ts = statement.getTimestamp(lastIndex);

      In this scenario, I'm always getting back the time result even if the update didn't match any row in database.
      When I drop the statement cache I get the result only if there was a row that was updated by this statement.

      I can't use the return value from executeUpdate() since it always return 1.

              jpederse@redhat.com Jesper Pedersen
              erahamim erahamim (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: