use of com.varsql.core.connection.ConnectionFactory in project varsql by varsqlinfo.
the class SQLManager method setSQLMapper.
public void setSQLMapper(ConnectionInfo connInfo, Object obj) {
try {
if (!(obj instanceof ConnectionFactory || obj instanceof SQLManager)) {
logger.error("SQLManager setSQLMapper access denied object {}", obj);
throw new VarsqlRuntimeException(VarsqlAppCode.EC_DB_POOL, "SQLManager setSQLMapper access denied object " + obj);
}
SqlSessionFactory sqlSessionFactory = sqlSessionFactory(connInfo).getObject();
try (Connection connChk = sqlSessionFactory.openSession().getConnection()) {
JdbcUtils.close(connChk);
}
sqlSessionFactoryMap.put(connInfo.getConnid(), sqlSessionFactory);
sqlSessionMap.put(connInfo.getConnid(), new SqlSessionTemplate(sqlSessionFactory));
} catch (Exception e) {
logger.error("connection info : {} ", VartechReflectionUtils.reflectionToString(connInfo));
logger.error("SQLManager :{} ", e.getMessage(), e);
throw new ConnectionException("getSqlSession IOException " + e.getMessage(), e);
}
}
Aggregations