我想在几个JEE6 WEB项目上共享一个JPA注释的实体模型 [英] I want to share a JPA annotated entity model over a several JEE6 WEB projects
问题描述
我想在几个JEE6 WEB项目上共享一个用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 {
我创建了一个仅带有注释的实体类的maven项目,即实体项目.
I created a maven project with only annotated entity classes, the entity project.
在客户端JEE6 WEB项目中,我创建了对此实体项目的依赖项. JEE6项目可以编译,但是在Glassfish应用程序服务器上执行时会出现运行时错误.该类未被识别为实体类.
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?
推荐答案
Have a look here for working example of how to do this.
这篇关于我想在几个JEE6 WEB项目上共享一个JPA注释的实体模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!