JDBCTransaction transaction = (JDBCTransaction)((TransactionFactory)resManager.getResource("SampleTransaction")).create();
/* 返回SQLExecutor工厂,并创建SQLExecutor对象 */
SQLExecutor sqlExecutor = transaction.getSQLExecutorFactory("SampleDataSource").create();
/* 返回SQLBuilder工厂,并创建SQLBuilder对象 */
SQLBuilder sqlBuilder = transaction.getSQLBuilderFactory("SampleDataSource").create("");
//sqlExecutor.setResultMaker(new MapResultMaker());
try{
/* 开始事务 */
transaction.begin();
// /* 构建查询条件 */
// Condition condition = new Condition();
// condition.add(new ConditionItem("Id","=",id));
/* 通过SQLBuilder来构建SQL语句 */
SQL sql = sqlBuilder.constructSQLForSelect("Messages",false,new Column[]{new Column("SUBJECT"),new Column("SENDER")},condition,null,null,3,2);
//SQL sql = sqlBuilder.constructSQLForSelect("Messages",true,null,condition,null,null);
logger.debug("通过SQLBuilder构建的SQL: " + sql.getSQLString());
return (List)sqlExecutor.execute(sql);