On 2 February 2010 09:20, Stephen Friedrich
<stephen.friedr...@fortis-it.eu> wrote:
> Another option for me would be to somehow get the final SQL statement and
> parameters, then execute that statement myself. Is that possible somehow?

I have something like this:

        String sqlId = ... // The 'id' of the SQL statement in the XML config
        Object param = ... // The parameter object for the query
        ResultSet rs = null;
        PreparedStatement ps = null;
        try {
            Configuration conf = sf.getConfiguration();
            MappedStatement ms = conf.getMappedStatement(sqlId);
            BoundSql boundSql = ms.getBoundSql(param);
            ParameterHandler pHandler = new
DefaultParameterHandler(ms, param, boundSql);

            stmt = conn.prepareStatement(boundSql.getSql());
            pHandler.setParameters(stmt);
            rs = stmt.executeQuery();

I don't really like it.  Manually handling the result set is probably
a premature optimisation for my use case.  But you live and learn.

Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org

Reply via email to