Bah, gmail messed up my code...let's try again...

===

   Reader reader;
   SqlMapClientImpl smc;
   SelectStatement statement;
   String sql;

   // this is just plumbing:
   reader = Resources.getResourceAsReader("com/mwt/config/sqlmap.xml");
   smc = (SqlMapClientImpl) SqlMapClientBuilder.buildSqlMapClient(reader);

   // At this point, you can get a statement and get freaky with it
   // ...all unsupported of course, and if a later release breaks it, you
   // have been warned. :-)
   statement = (SelectStatement)
       smc.getDelegate().getMappedStatement("Customers.fetch");

   // replace the 2nd parameter below with YOUR parameter object, a
   // bean or map or whatever.
   sql = statement.getSql().getSql(null, null);

   // ALSO, who says this has to be SQL? it could be HQL, or an LDAP query, or
   // whatever other crazy stuff you want to try. This is the result
   // in any case:
   System.out.println(sql);

===

Larry

Reply via email to