Hi I am getting an exception while doing db operations.
java.lang.RuntimeException: No EntityManager found in the context. Try to annotate your action method with @play.db.jpa.Transactional
Below is the code
paymentResponse.onRedeem(response -> persistTransaction(response, buyerInformation.getCustomerId()));
paymentResponse.onRedeem(response -> completeProductOrder(response, buyerInformation));
paymentResponse.onRedeem(response -> postSuccessfulProcess(response, purchasePayload, buyerInformation));
persistTransaction and postSuccessfulProcess are doing db update transactions using something like below
JPA.withTransaction(() -> {
and code to save is like
JPA.em().persist(entity);
withTransaction binds EntityManager from the map with key "default" but JPA.em() actually looks for EntityManager with name currentEntityManager. I tried to use JPA.em("default") but it gives connection timeout.
I am new to play framework. Can you please suggest me some remedy for this issue.