我有一个EJB项目,它有persistence.xml,它有2个持久性单元。我正在使用OpenJPA ant任务进行构建时间增强。问题是,它只增强了第一个持久性单元中提到的类。其他持久性单元中的类将被忽略。
的persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="ora_agen_test"
transaction-type="RESOURCE_LOCAL">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>jdbc/ora_agen</jta-data-source>
<jar-file>some.jar</jar-file>
<class>company.some.entity.account3</class>
<properties>
<property name="openjpa.ConnectionURL"
value="jdbc:oracle:thin:@//dbsrvoractc32:1521/oractc32" />
<property name="openjpa.ConnectionUserName" value="agenproc" />
<property name="openjpa.ConnectionPassword" value="yUqM2~GK" />
<property name="openjpa.ConnectionDriverName" value="oracle.jdbc.driver.OracleDriver" />
<property name="openjpa.jdbc.Schema" value="agen" />
<property name="openjpa.Log" value="log4j" />
<property name="openjpa.ConnectionFactoryProperties"
value="PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true" />
<property name="openjpa.RuntimeUnenhancedClasses" value="unsupported" />
<property name="openjpa.ConnectionRetainMode" value="transaction" />
<property name="openjpa.jdbc.DBDictionary" value="JoinSyntax=sql92" />
</properties>
</persistence-unit>
<persistence-unit name="ora_acnt_test"
transaction-type="RESOURCE_LOCAL">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>jdbc/ora_acnt</jta-data-source>
<jar-file>some.jar</jar-file>
<class>company.some.entity.Account1</class>
<class>company.some.entity.Account2</class>
<properties>
<property name="openjpa.ConnectionURL"
value="jdbc:oracle:thin:@//dbsrvoractc32:1521/oractc32" />
<property name="openjpa.ConnectionUserName" value="acntproc" />
<property name="openjpa.ConnectionPassword" value=":kU|31iE" />
<property name="openjpa.ConnectionDriverName" value="oracle.jdbc.driver.OracleDriver" />
<property name="openjpa.jdbc.Schema" value="acnt" />
<property name="openjpa.Log" value="log4j" />
<property name="openjpa.ConnectionFactoryProperties"
value="PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true" />
<property name="openjpa.RuntimeUnenhancedClasses" value="unsupported" />
<property name="openjpa.ConnectionRetainMode" value="transaction" />
<property name="openjpa.jdbc.DBDictionary" value="JoinSyntax=sql92" />
</properties>
</persistence-unit>
Ant脚本(目标):
<target name="enhance" depends="jarchive_nomanifest,jarchive_manifest"
description="Write out enhance data used during the build">
<startBuildActivity repositoryAddress="${repositoryAddress}"
userId="${userId}" passwordFile="${passwordFile}" parentActivityID="${parentActivityId}"
activityIdProperty="activityId" label="Enhance Information of ${name}"
autoComplete="false" verbose="true" buildResultUUID="${buildInfo.buildResultUUID}" />
<openjpac>
<config propertiesFile="${dir.src}/META-INF/persistence.xml" />
<!-- <fileset dir="${dir.build}/bin">
<include name="**/*" />
</fileset> -->
<classpath refid="application.classpath" />
</openjpac>
<completeBuildActivity repositoryAddress="${repositoryAddress}"
userId="${userId}" passwordFile="${passwordFile}" activityId="${activityId}"
verbose="true" buildResultUUID="${buildInfo.buildResultUUID}" />
</target>
&LT; /文件集&GT; - &GT;