这是我的班级:
@Stateless
public class MyClass {
@Inject
UserTransaction tx;
public void myMethod() throws Exception {
try {
// ...
tx.begin();
// Call DAOs for DB updates
tx.commit();
} catch(Exception ex) {
tx.rollback();
throw ex;
}
}
}
tx.commit()/ tx.rollback()会关闭JDBC连接吗?