I’m new to Scala, and I can’t figure out how to solve a compiling error for method withTransaction
:
Cannot resolve overloaded method 'withTransaction'
@Transactional
override def onGet() {
JPA.withTransaction(() => {
val resultsList = JPA.em.createNamedQuery("findCity").setParameter("name", name).getResultList
});
This code snippet is located in a Global.scala file in Play project (version 2.3.X). JPA came from import play.db.jpa.JPA
How can I solve this compiling error?