Hi!
I’ve got a strange issue in my project based on Cuba Platform 7.2.13.
There is a data loader delegate method in the browse screen controller in the web module
@Inject
private BalanceService balanceService;
@Install(to = “balanceDl”, target = Target.DATA_LOADER)
public List balanceDlLoadDelegate(LoadContext context) {
…
return new ArrayList<>(balanceService.getBalanceByDate(calcDate));
}
Interface BalanceService is defined in the global module.
Implementation bean BalanceServiceBean is defined in the core module and returns Set of non-persistent entities. In the implementation bean there are several JPQL-queries, and the issue is that I can’t use Transactional annotation in methods which provide queries. When I use Transactional, I receive an exception:
com.haulmont.cuba.core.global.RemoteException: No active transaction on persistence.getEntityManager() invocation.
But if I use
try (Transaction tx = persistence.getTransaction()) {
EntityManager em = persistence.getEntityManager();
…
}
it works correct.
What’s wrong with using of the Transactional annotation in this bean? In other spring beans in the core module it works fine.