[RuntimeException: No EntityManager bound to this thread. Try to annotate your action method with @play.db.jpa.Transactional]
@play.db.jpa.Transactional
private static AuthUser getUserByNameAndPass(String userName, String password){
return (AuthUser) JPA.em().createNamedQuery(AuthUser.getByCredentials).setParameter("userName", userName).setParameter("password", password).getSingleResult();
}
return (AuthUser) JPA.em("pu").createNamedQuery(AuthUser.getByCredentials).setParameter("userName", userName).setParameter("password", password).getSingleResult();
Execution exception [[RuntimeException: No JPA EntityManagerFactory configured for name [auth]]]
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="pu" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<non-jta-data-source>MyDS</non-jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
</properties>
</persistence-unit>
</persistence>
play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[RuntimeException: No JPA EntityManagerFactory
configured for name [auth]]]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:82) [play_2.9.1.jar:2.0]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:63) [play_2.9.1.jar:2.0]
at akka.actor.Actor$class.apply(Actor.scala:290) [akka-actor.jar:2.0]
at play.core.ActionInvoker.apply(Invoker.scala:61) [play_2.9.1.jar:2.0]
at akka.actor.ActorCell.invoke(ActorCell.scala:617) [akka-actor.jar:2.0]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:179) [akka-actor.jar:2.0]
Caused by: java.lang.RuntimeException: No JPA EntityManagerFactory configured for name [auth]
at play.db.jpa.JPA.em(JPA.java:33) ~[play_2.9.1.jar:2.0]
at com.stepman.ag.auth.AuthenticationService.getByCredentials(AuthenticationService.java:80) ~[classes/:na]
at com.stepman.ag.auth.AuthenticationService.handleAuthentication(AuthenticationService.java:29) ~[classes/:na]
at com.stepman.ag.controllers.Login.authenticate(Login.java:20) ~[classes/:na]
at Routes$$anonfun$routes$1$$anonfun$apply$3$$anonfun$apply$4.apply(routes_routing.scala:52) ~[classes/:na]
at Routes$$anonfun$routes$1$$anonfun$apply$3$$anonfun$apply$4.apply(routes_routing.scala:52) ~[classes/:na]