public void runStatementsUsingSetUserConnection()
{
SqlMapClient sqlMapClient =SqlMapClientConfig.getSqlMapClient();
Connection conn = null;
try {
conn = dataSource.getConnection();
conn.setAutoCommit(false);
sqlMapClient.setUserConnection(conn);
Person p =(Person)sqlMapClient.queryForObject("getPerson", new Integer(9));
p.setLastName("Smith");
sqlMapClient.update("updatePerson", p);
Department d =(Department)sqlMapClient.queryForObject("getDept", new Integer(3));
p.setDepartment(d);
sqlMapClient.update("updatePersonDept", p);
conn.commit();
} finally {
sqlMapClient.setUserConnection(null);
if (conn != null) conn.close();
}
}