java如何在weblogic中使用hibernate代替eclipselink?
我在jboss服务器上安装了一个应用程序,实际上正在使用hibernate-jpa-2.0,当我试图在weblogic上运行这个应用程序时,我看到eclipselink中关于jpa注释的错误。我认为在这种情况下,我有两个选择,将我的应用程序更改为eclipselink或在weblogic中使用hibernate。问题是,如何在weblogic应用程序中声明。xml/weblogic。xml使用hibernate而不是eclipselink。这是可能的吗?正在发生的错误如下所示:
Substituted for missing class Exception [EclipseLink-7298] (Eclipse Persistence Services - 2.6.5.v20170607-b3d05bd) - org.eclipse.persistence.exceptions.ValidationException Exception Description: The mapping [associado] from the embedded ID class [class br.com.project.web.model.associate.pk.AssociateMaintainPK] is an invalid mapping for this class. An embeddable class that is used with an embedded ID specification (attribute [.AssociateMaintainPK] from the source [class br.com.project.web.model.associate.AssociateMaintain]) can only contain basic mappings. Either remove the non basic mapping or change the embedded ID specification on the source to be embedded.
# 1 楼答案
您需要从weblogic部署描述符引用hibernate库(如果捆绑包是
war
,则为weblogic.xml;如果捆绑包是ear
,则为weblogic-application.xml)。可以部署与应用程序共定位的库,也可以部署为一组共享库(如果被部署在同一weblogic实例上的多个应用程序使用)(这是我使用的解决方案)。这样,WLS将使用引用的库,而不是与weblogic(EclipseLink for JPA api)捆绑的默认实现