conn.setTransactionIsolation(4);
这句话报错java.sql.SQLException: 非法的事务隔离级,是因为达梦的数据库事务隔离级别不一样的原因
以前一个项目,从mysql转移到达梦,snaker这块用不了了,应该是事务拦截这块的事务隔离有问题
public class NutzTransactionInterceptor extends TransactionInterceptor {
private static final Logger log = LoggerFactory.getLogger(NutzTransactionInterceptor.class);
public void initialize(Object accessObject) {
//ignore
}
protected TransactionStatus getTransaction() {
try {
boolean isNew = false;
if(Trans.get() == null) {
Trans.begin(Connection.TRANSACTION_REPEATABLE_READ);
isNew = true;
}
return new TransactionStatus(Trans.get(), isNew);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RuntimeException(e.getMessage(), e);
}
}
protected void commit(TransactionStatus status) {
try {
Trans.commit();
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
} finally {
try {
Trans.close();
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RuntimeException(e.getMessage(), e);
}
}
}
protected void rollback(TransactionStatus status) {
try {
Trans.rollback();
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
} finally {
try {
Trans.close();
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RuntimeException(e.getMessage(), e);
}
}
}
}
Trans.begin(Connection.TRANSACTION_REPEATABLE_READ);这句话有错,还是觉得snaker轻量级 ,uflo2还要hibernate,不喜欢