I`m using the play framework (scala) with hibernate 4 (orm).

I created some models.. here my example model:

class AModel {  

  var id:Long = 0

  var contact:Contact = null


My DAO is inside the same file as my AModel class:

object AModel extends GenericDao(classOf[AModel]){
    def getAllModels():List[AModel] = {
      val query = entityManager.createQuery("FROM " + classOf[AModel].getName)
      val result = query.getResultList.asInstanceOf[List[AModel]]
      return result

In my persistence.xml I map the AModel class as follows:

<persistence-unit name="HibernateService">
        Persistence unit
      <!-- all properties -->

Still it sais that it cant find any suitable mapping. What am I doing wrong?

Here the output:

no persistent classes found for query class: FROM models.AModel$

I hope there is somebody able to help me. Thanks in advance..

No correct solution


I found the error for this concrete issue. I used the objects (DAO) class name within the query. The solution was to switch to the class AModel! (Not the Object AModel)

No I have another issue..

I receive a hibernate.QueryException: could not resolve property: type of: models.AModel

Does anyone know anything about this exact error message?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow