Thursday, July 31, 2014

Play Framework "Model Class" NOT an Entity Bean registered with this server?

Sometimes you may get PersistenceException while trying to run a Play application.

For example there is a Employee model class.  While running the play app it throws the following exception.

PersistenceException: models.Employee is NOT an Entity Bean registered with this server?


Solution : The simple solution is to annotate the Employee class with @Entity.  Doing this tells the application to treat the Employee model as an Entity.  Here is the code snippet...


import play.db.ebean.Model;
import javax.persistence.*;

@Entity
public class Employee extends Model{ ... }

No comments:

Post a Comment