问题描述
|
我正在使用Apache Felix中来自Springsource(版本1.1.0)的Eclipselink捆绑软件。我的(带有JPA批注的)实体类得到了持久存储等,因此基本机制有效。但是,我怀疑字节码编织是否完成。
如何验证Eclipselink是否在类上使用编织?
在Felix中运行时通常支持编织吗?我没有更改配置或启动脚本的任何内容,我必须这样做吗?
解决方法
请参阅Eclipse文档-页面底部;
import org.eclipse.persistence.internal.helper.Helper;
import org.eclipse.persistence.internal.weaving.PersistenceWeaved;
...
if (Helper.classImplementsInterface(MyEntity.class,PersistenceWeaved.class)) {
// MyEntityEntity successfully woven!
...
,我可以看到两种确定是否启用动态编织的方法:
在persistence.xml
中将EclipseLink的日志级别设置为FINEST
,并且在EntityManagerFactory
/PersistenceUnit
初始化期间,无论是否使用编织,您都会在日志中看到。
确定为您的应用程序提供服务的jvm进程。使用OS工具或Java工具(如jconsole / jvisualvm)确定命令行。如果可以在vm参数中发现eclipselink代理(-javaagent:eclipselink.jar
),则启用动态编织-否则不启用。
,我建议您在此环境中使用静态编织。