• Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0 M2
    • Fix Version/s: 1.0 M3
    • Component/s: JDO
    • Labels:
    • Environment:
      Castor v1.0M2
      Windows XP
    • Number of attachments :


      We have found an issue trying to log some SQL statements created by castor.

      "updates", "selects", "deletes" and "inserts" sqls are correctly logged with the "PreparedStatementProxy" class.

      However "inserts" where a key generator (with the returning option) is used is not logged.

      That is because, in such environment, a CallableStatement is created, not a PreparedStatement.

      The ConnectionProxy do not wrap the CallableStatement with a "CallableStatementProxy" as it does with the prepared statement.

      Therefore, CallableStatements do not show their SQLs properly.

      We have modified the castor code in order to introduce a new "CallableStatementProxy" class that do the same that the "PreparedStatementProxy" one but right for callable statements (It is almost a perfect copy of "PreparedStatementProxy").

      We have modified the "ConnectionProxy" class, as well, in order to use this "CallableStatementProxy".

      The version of the "CallableStatementProxy" provided in the patch is a copy of the PreparedStetementProxy that uses CallableStatements instead of PreparedStatements. It registers, as well, all the parameter values entered in order to write them correctly in the "toString()" method, which is exactly the same as the one from "PreparedStatementProxy".

      Nevertheless, all the additional methods of the CallableStatement interface just delegate to the internal "callableStatement" member variable without storing the parameters as those from the "preparedStatementProxy". That could be, maybe, improved for future releases (perhaps we have been very lazy about this, sorry).



      P.D.: I hope the patch is well done. It is the first time I do one. Please, tell me if there is something wrong.

      1. log_callableStatemens02.patch
        51 kB
        Raúl Sanz de Acedo Pérez
      2. patch.C1316.20060210.txt
        47 kB
        Werner Guttmann
      3. patch.C1316.20060210-002.txt
        49 kB
        Werner Guttmann
      4. patch.C1316.20060210-003.txt
        115 kB
        Werner Guttmann

        Issue Links


          Werner Guttmann logged work - 10/Feb/06 1:49 PM
          • Time Spent:
            25 minutes
            Bug submission preparations, code cleanup, code styling, Javadocs


            • Assignee:
              Werner Guttmann
              Raúl Sanz de Acedo Pérez


              • Created:

                Time Tracking

                Original Estimate - Not Specified
                Not Specified
                Remaining Estimate - 0 minutes
                Time Spent - 25 minutes