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.