jpa 多数据源 persistence-unit打包一直报错 javax.annotation.processing.FilerException: Attempt to recreate a fi
程序员文章站
2022-04-01 10:26:22
...
参考文档:http://blog.sina.com.cn/s/blog_823ecaee0102v11q.html
参考文档是说不同数据源中有相同的实体会造成这个问题,我本地也是存在着两个数据源有相同的表
后解决方案就是把多数据源的实体按照不同的包进行引入
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="InusrancePU" transaction-type="JTA">
<jta-data-source>insurance</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<shared-cache-mode>NONE</shared-cache-mode>
<properties>
<property name="eclipselink.canonicalmodel.subpackage" value="com.quxing.persistence.entitys"></property>
</properties>
</persistence-unit>
<persistence-unit name="HermesPU" transaction-type="JTA">
<jta-data-source>hermes</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<shared-cache-mode>NONE</shared-cache-mode>
<properties>
<property name="eclipselink.canonicalmodel.subpackage" value="com.quxing.persistence.hermesEntity"></property>
</properties>
</persistence-unit>
</persistence>
上一篇: 位运算
下一篇: 代码风格以及代码中的分号问题