当我尝试在weblogic中部署应用程序时,他给了我以下例外:
替换为缺少的类Exception [EclipseLink-7298](Eclipse 持久性服务-2.6.5.v20170607-b3d05bd)- org.eclipse.persistence.exceptions.ValidationException异常 说明:嵌入式ID类的映射[关联] [class br.com.webproj.web.model.associated.pk.AssmaintainPK]是 此类的无效映射。与以下对象一起使用的可嵌入类 嵌入式ID规范(属性[AssmaintainPK]来自 源[br.com.webproj.web.model.associated.AssMaintain类])可以 仅包含基本映射。删除非基本映射或 更改要嵌入的源上的嵌入ID规范。
在我的persistence.xml
中,我有:
<?xml version="1.0" encoding="UTF-8"?>
<persistence 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"
version="2.0">
<persistence-unit name="Web_PU">
<jta-data-source>JDBC/WEB</jta-data-source>
<jar-file>web-Model.jar</jar-file>
<shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.Oracle10gDialect" />
<property name="hibernate.hbm2ddl.auto" value="none" />
<property name="hibernate.show_sql" value="false" />
<!-- Cache Enabled -->
<property name="hibernate.cache.use_second_level_cache"
value="true" />
<property name="hibernate.cache.use_query_cache"
value="true" />
<property name="hibernate.cache.region.factory_class"
value="org.hibernate.cache.infinispan.JndiInfinispanRegionFactory" />
<property name="hibernate.cache.infinispan.cachemanager"
value="java:jboss/infinispan/container/hibernate" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup" />
<property name="hibernate.cache.infinispan.statistics"
value="true" />
<!-- I TRIED INCLUDING THIS, BUT NOT SOLVE -->
<property name="eclipselink.exclude-eclipselink-orm"
value="false" />
<property name="eclipselink.orm.throw.exceptions"
value="false" />
<property name="eclipselink.orm.validate.schema"
value="false" />
</properties>
</persistence-unit>
</persistence>
我认为发生此错误是因为Weblogic使用eclipse链接,而项目使用了另一个版本的jpa。但是错误是在项目中包含的jar中,我无法更改并查看代码。如果问题是这样,我该怎么做才能不使用Weblogic的eclipse链接(obs:在JBoss中,项目正常运行)。