I have problem with hibernate entity while working with submodules in playframework.
Normally (in single app without submodules) I've used that code:
package models;
@Entity
public class AppMode {
public static AppMode getCurrentConfigurationEntry() {
return JPA.em().find(AppMode.class, 1L);
}
}
But now I have to tell hibernate entity manager to scan submodules models, cause I'm getting an error:
[IllegalArgumentException: Unknown entity: AppMode]
My model class in submodule is in package:
package models.common;
I've already tried:
return JPA.em().find(models.common.AppMode.class, 1L);
return JPA.em().find(common.models.AppMode.class, 1L);
but I'm getting the same error:
[IllegalArgumentException: Unknown entity: models.common.AppMode]
My question is: How to configure hibernate in play subproject to add submodules models class to classpath at runtime?
I have in both build.sbt files declared libraryDependencies with hibernate.
Should I have persistence.xml file/configuration for each module?