我正在尝试使用Spring/JPA配置和Maven多模块项目。这是总体布局。我有一个包含5个子模块的根模块。DDD,JPA和多模块Maven
backoffice (root maven module) | -(maven module)-----core (this is where persistence.xml and entityManager stuff resides). | -(maven module)-----employee (employee related entities, controllers, etc.) | -(maven module)-----vendor (vendor related entities, controllers, etc.) | -(maven module)-----customer (customer related entities, controllers, etc.) | -(maven module)-----web (contains all the web stuff).
我在核心/ src目录/主/资源/ META-INF所有的JPA的东西(persistence.xml中,弹簧语境W/EntityManagerFactory的,数据源等)。这个想法是我想分享所有子模块(员工,供应商和客户)的持久性材料。
问题是,当Web应用程序启动时,它无法找到EntityMangerFactory。如果我在每个子模块(员工,供应商和客户)中设置JPA东西,那么它就可以工作。
如何在核心中设置所有与持久性相关的东西,然后在其他模块中共享它?
在此先感谢。
您是否向员工,供应商和客户模块添加了对核心的依赖关系?老实说不知道我会让他们作为单独的模块,甚至 – willcodejavaforfood 2010-11-28 18:14:25
好吧,我忘了添加上下文文件从核心到我的web.xml。现在我已经完成了web应用程序的启动,但它无法在其他模块中找到实体。 – user523078 2010-11-28 19:02:04