protected Object executeWith(DataSource dataSource, SqlMapClientCallback action) { SqlMapSession session = getSqlMapClient().openSession();
protected Object executeWith(Connection connection, SqlMapClientCallback action) { SqlMapSession session = getSqlMapClient().openSession(); try { try { session.setUserConnection(connection); } catch (SQLException e) { throw new CannotGetJdbcConnectionException("Could not get JDBC Connection", e); } try { return action.doInSqlMapClient(session); } catch (SQLException ex) { throw new SQLErrorCodeSQLExceptionTranslator().translate("SqlMapClient operation", null, ex); } } finally { session.close(); } }
public void performIndex(CompassSession session, IndexEntity[] entities) throws CompassException { for (IndexEntity entity : entities) { SqlMapIndexEntity indexEntity = (SqlMapIndexEntity) entity; SqlMapSession sqlMapSession = getSqlMapClient().openSession(); try { sqlMapSession.startTransaction(); if (log.isDebugEnabled()) { log.debug(buildMessage("Indexing select statement id [" + indexEntity.getStatementId() + "]")); } sqlMapSession.queryWithRowHandler(indexEntity.getStatementId(), indexEntity.getParam(), new SqlMapClientGpsDeviceRowHandler(indexEntity, session, pageSize)); session.evictAll(); sqlMapSession.commitTransaction(); } catch (SQLException e) { throw new SqlMapGpsDeviceException("Failed to fetch paginated list for statement [" + indexEntity.getStatementId() + "]", e); } finally { try { try { sqlMapSession.endTransaction(); } catch (Exception e) { log.warn(buildMessage("Failed to close sqlMap session, ignoring"), e); } } finally { sqlMapSession.close(); } } } } }
SqlMapSession session = this.sqlMapClient.openSession(); try { Connection con = DataSourceUtils.getConnection(getDataSource());