使用Eclipselink时,@OneToMany
包含时persistence.xml
无效(返回null):
(适用滴和创建)
<property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
但它适用于此:
(无)
<property name="javax.persistence.schema-generation.database.action" value="none"/>
以下是文件persistence.xml
的所有代码:
<?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="XXXX-ejbPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/xxxxDatasource</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<shared-cache-mode>ALL</shared-cache-mode>
<properties>
<property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
<property name="eclipselink.target-database" value="MySQL"/>
<property name="eclipselink.logging.level.sql" value="OFF"/>
<property name="eclipselink.logging.parameters" value="true"/>
<property name="eclipselink.persistence-context.flush-mode" value="AUTO"/>
</properties>
</persistence-unit>
</persistence>
P.S:@OneToMany
可以正常使用Hibernate。
有没有人能解决这个问题?