Hello. I’m a bit confused on whats happening here.
I load an entity using the datamanager but cant execute the next function with the @Transactional annotation. Thank you for the help explaining this odd behaviour.
@Override
public void testTx() {
User user = dataManager.load(User.class).query("SELECT u from sec$User u where u.login = 'admin'").one();
System.out.println("user = " + user);
//NO ACTIVE TRANSACTION
simpleFun();
}
@Transactional
void simpleFun(){
logTxId();
}
private void logTxId() {
String firstResult = (String) persistence.getEntityManager()
.createNativeQuery("SELECT CAST(txid_current() AS text)").getFirstResult();
System.out.println(firstResult);
}