1
votes

I'm new with Play. I use the 2.0 Version I try to connect my projet to a postgresql databse and use jpa to retreived data. I can connect to the database but i fail to lauch request with jpa.

When i try in my User model in methode authenticate

Query query = JPA.em().createQuery("myQuery")

I have this message '

[RuntimeExeption: No EntityManager bound to this thread. Try to annotate your action method with @play.db.jpa.Transactional]

Sorry for my bad english :)

1
Could you please show the structure of your model ?Nacef

1 Answers

0
votes

You have to anotate the method of the controller that calls User.autenticate() with @Transactional (package play.db.jpa).