0
votes

Hi i'm having some problem with ebean and play configuration, seems like i can't get the ebean server recognize some classes in my project, i got

[PersistenceException: The type [class model.mappe.NodoSemplice] 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().]

where the class model.mappe.NodoSemplice is as such

@Entity

public class NodoSemplice extends NodoApprendimento {

and

@Entity

@Table(name="nodi_app")

public abstract class NodoApprendimento extends Model{

the imports are correct and the ebeanserver configuration is as such

    ServerConfig def = new ServerConfig();
    def.setName("fluidefault");
    def.setDataSource(play.db.DB.getDataSource("fluiddefault"));

    //i package delle classi di sistema
    def.addPackage("model.contributi.*");
    def.addPackage("model.corpi.*");
    def.addPackage("model.mappe.*");
    def.addPackage("model.utenti.*");

    def.setDdlGenerate(true);    //per generare il DataDefinitionLanguage

    fluidefault = EbeanServerFactory.create(def);

the save was done trough via

 public void save(NodoApprendimento nodoApprendimento){
    nodoApprendimento.save(fluidefault.getName());
}

the server bootstrap is fine and also talking with it but still i got the persistence exception because the server can't recognize the class as an entity

1

1 Answers

0
votes

Check the following 3 points:

  1. Try to annotate table (@table) with your concrete class NodoSemplice, not your abstract class NodoApprendimento.

    It makes more sense to bind your table with your concrete class.

  2. Make sure a table named nodi_app exists in the database you connected to, and the schema is public.

  3. In your application.conf, enable Ebean:

    ebean.default="models.*"