当我运行使用 jpa 的 rcp 应用程序时,我收到以下警告消息:
[EL Info]: 2012-05-23 22:29:26.841--ServerSession(20341825)--EclipseLink, version: Eclipse Persistence Services - 2.3.2.v20111125-r10461
[EL Warning]: 2012-05-23 22:29:27.338--ServerSession(20341825)--Reverting the lazy setting on the OneToOne or ManyToOne attribute [infoid] for the entity class [class org.company.management.entity.Employee] since weaving was not enabled or did not occur.
[EL Warning]: 2012-05-23 22:29:27.339--ServerSession(20341825)--Reverting the lazy setting on the OneToOne or ManyToOne attribute [groupid] for the entity class [class org.company.management.entity.Employee] since weaving was not enabled or did not occur.
[EL Warning]: 2012-05-23 22:29:27.339--ServerSession(20341825)--Reverting the lazy setting on the OneToOne or ManyToOne attribute [employeeSchedule] for the entity class [class org.company.management.entity.Employee] since weaving was not enabled or did not occur.
[EL Warning]: 2012-05-23 22:29:27.34--ServerSession(20341825)--Reverting the lazy setting on the OneToOne or ManyToOne attribute [employeescheduleid] for the entity class [class org.company.management.entity.EmployeeScheduleInfo] since weaving was not enabled or did not occur.
[EL Warning]: 2012-05-23 22:29:27.34--ServerSession(20341825)--Reverting the lazy setting on the OneToOne or ManyToOne attribute [scheduleid] for the entity class [class org.company.management.entity.EmployeeSchedule] since weaving was not enabled or did not occur.
[EL Warning]: 2012-05-23 22:29:27.34--ServerSession(20341825)--Reverting the lazy setting on the OneToOne or ManyToOne attribute [employeeid] for the entity class [class org.company.management.entity.EmployeeSchedule] since weaving was not enabled or did not occur.
[EL Warning]: 2012-05-23 22:29:27.341--ServerSession(20341825)--Reverting the lazy setting on the OneToOne or ManyToOne attribute [employee] for the entity class [class org.company.management.entity.EmployeeInfo] since weaving was not enabled or did not occur.
[EL Info]: 2012-05-23 22:29:27.556--ServerSession(20341825)--bundleresource://29.fwk31583837:2_Management login successful
我想启用延迟加载。
我的 persistence.xml 看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="Management" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>org.company.management.entity.EmployeeGroup</class>
<class>org.company.management.entity.Company</class>
<class>org.company.management.entity.Employee</class>
<class>org.company.management.entity.Schedule</class>
<class>org.company.management.entity.EmployeeInfo</class>
<class>org.company.management.entity.EmployeeSchedule</class>
<class>org.company.management.entity.EmployeeScheduleInfo</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:derby:.cafedb;create=true"/>
<property name="javax.persistence.jdbc.password" value="vodbomb"/>
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="javax.persistence.jdbc.user" value="root"/>
<property name="eclipselink.ddl-generation" value="create-tables" />
</properties>
</persistence-unit>
</persistence>
我有一个构建脚本“build.xml”来进行静态编织:
<project name="Management" basedir=".">
<target name="define.task" description="New task definition for toplink static weaving">
<taskdef name="weave" classname="org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask">
</taskdef>
</target>
<target name="weaving" description="perform weaving" depends="define.task"
<weave source="${basedir}/src/org/company/management/entity"
target="${basedir}/src/org/company/management/entity/woven.jar"
persistenceinfo="${basedir}/META-INF/persistence.xml">
</weave>
</target>
</project>
当我运行 ant 脚本“build.xml”时,我遇到了这个错误:
Buildfile: C:\Users\J\workspace\org.company.management\build.xml
define.task:
weaving:
BUILD FAILED
C:\Users\J\workspace\org.company.management\build.xml:13: Exception [EclipseLink-40007] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.StaticWeaveException
Exception Description: An exception was thrown while weaving: C:\Users\J\workspace\org.company.management\src\org\company\management\entity
Internal Exception: Exception [EclipseLink-40001] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.StaticWeaveException
Exception Description: An exception was thrown while trying to open an archive from URL: file:/C:/Users/J/workspace/org.company.management/META-INF/persistence.xml
Internal Exception: java.util.zip.ZipException: error in opening zip file
Total time: 242 milliseconds
如何启用静态编织???我一团糟