Play Framework: PersistenceException: The type is not a registered entity? (Ebean)

时间秒杀一切 提交于 2019-11-29 03:45:52

问题


I'm following the Play Framework 2.0 tutorial for Java and get this error when trying to save an ebean Model (task.save()).

[PersistenceException: The type [class models.Task] is not a registered entity? If you don't explicitly list the entity classes to use Ebean will search for them in the classpath. If the entity is in a Jar check the ebean.search.jars property in ebean.properties file or check ServerConfig.addJar().]


回答1:


Check these 3 points :

  • Your model is annotated with @Entity (javax.persistence.Entity)
  • Your model extends Model (play.db.ebean.Model)
  • Ebean is enable in your application.conf ebean.default="models.*" (if your classes are in the models package)


来源:https://stackoverflow.com/questions/9824190/play-framework-persistenceexception-the-type-is-not-a-registered-entity-ebea

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!