Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I want to share a JPA annotated entity model over a several JEE6 WEB projects

Tags:

java

maven

jpa

I want to share an entity model, annotated with JPA, over a several JEE6 WEB projects. The entities are annotated like this:

@Entity
public class Contract implements Serializable {

I created a maven project with only annotated entity classes, the entity project.

In the client JEE6 WEB project I created a dependency on this entity project. The JEE6 project is able to compile, but when executing on a Glassfish application server there is a runtime error. The class is not recognized as a Entity class.

Caused by: java.lang.IllegalArgumentException: Object: nl.marcenschede.modules.Contract[ id=null ] is not a known entity type.

What to do for an imported class to be recognized as an entity project?

like image 388
Marc Enschede Avatar asked Nov 12 '22 04:11

Marc Enschede


1 Answers

Have a look here for working example of how to do this.

like image 81
Eugene Loy Avatar answered Nov 14 '22 23:11

Eugene Loy