[英]Multiple persistence files in spring
I'm trying to create multiple modules with multiple persistence xml files. 我正在尝试使用多个持久性xml文件创建多个模块。 Idea is to keep entity classes inside same module it belongs to.
想法是将实体类保留在它所属的相同模块内。
Module 'A' configured with JPA with persistence.xml and working fine. 使用Persistence.xml和JPA配置的模块'A'正常工作。 Module 'B' has dependency with Module 'A' and has its own persistence.xml.
模块“ B”与模块“ A”具有依赖性,并且具有自己的persistence.xml。
When I try to use I get 当我尝试使用时,我得到
IllegalStateException:Conflicting persistence unit definitions for name in
I'm building this test app with spring roo. 我正在用Spring Roo构建这个测试应用程序。 Please shed a light on this.
请阐明这一点。 cheers
干杯
Review the persistance unit names in each persistence.xml 查看每个persistence.xml中的持久性单元名称
Something like persistanceUnit for the Module A (that works fine) and persistanceUnitB for Module B. 类似于ModuleA的persistanceUnit(可以正常工作)和Module B的persistanceUnitB。
Besides, you'll have to asign the appropriate persistance unit to each Entity. 此外,您必须为每个实体分配适当的持久性单元。 You can use the corresponding attribute in the Roo annotation
您可以在Roo批注中使用相应的属性
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.