简体   繁体   English

如何在Weblogic中使用休眠而不是eclipselink?

[英]how can i use hibernate instead eclipselink in weblogic?

I have an application wheeling in jboss server, and actually is using hibernate-jpa-2.0, when i tryied to run this app on the weblogic i see an error from the eclipselink about JPA annotations. 我在jboss服务器中运行了一个应用程序,并且实际上正在使用hibernate-jpa-2.0,当我尝试在weblogic上运行此应用程序时,我从eclipselink中看到有关JPA批注的错误。 I think am have two options in this case, change my application to eclipselink OR use hibernate in weblogic. 我认为在这种情况下有两个选择,将我的应用程序更改为eclipselink或在weblogic中使用休眠模式。 The question is, how can i declare in my weblogic-application.xml / weblogic.xml to use hibernate and not the eclipselink. 问题是,如何在我的weblogic-application.xml / weblogic.xml中声明使用休眠而不是eclipselink。 This is possible ? 这个有可能 ? The error that is happening is as follows: 发生的错误如下:

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. 替换为缺少的类异常[EclipseLink-7298](Eclipse Persistence Services-2.6.5.v20170607-b3d05bd)-org.eclipse.persistence.exceptions.ValidationException异常描述:嵌入式ID类[br.class的映射] [associado]。 com.project.web.model.associate.pk.AssociateMaintainPK]是此类的无效映射。 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. 与嵌入式ID规范一起使用的可嵌入类(来自源[br.com.project.web.model.associate.AssociateMaintain]类的属性[.AssociateMaintainPK])只能包含基本映射。 Either remove the non basic mapping or change the embedded ID specification on the source to be embedded. 删除非基本映射或更改要嵌入的源上的嵌入ID规范。

You will need to reference your hibernate libraries from your weblogic deployment descriptor (either weblogic.xml if your bundle is a war or weblogic-application.xml for an ear ). 您将需要从weblogic部署描述符(如果捆绑包是war weblogic.xml或ear weblogic-application.xml)引用休眠库。 Either deploy the libraries colocated with your app or as a set of shared libraries if used by multiple apps deployed on the same weblogic instance (this is the solution I use). 如果与在同一weblogic实例上部署的多个应用程序一起使用,则可以将这些库与您的应用程序并置在一起,也可以作为一组共享库来部署(这是我使用的解决方案)。 This way WLS will use the library referenced instead of the default implementation bundled with weblogic (EclipseLink for JPA api). 这样,WLS将使用引用的库而不是与weblogic捆绑在一起的默认实现(EclipseLink for JPA api)。

<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd 
    http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.8/weblogic-web-app.xsd">
... config stuff
<!-- hibernate orm -->
<library-ref>
    <library-name>hibernate-core</library-name>
</library-ref>
<library-ref>
    <library-name>hibernate-entitymanager</library-name>
</library-ref>
<library-ref>
    <library-name>hibernate-envers</library-name>
</library-ref>
<library-ref>
    <library-name>hibernate-jpa-2.1-api</library-name>
</library-ref>
<!-- hibernate orm deps -->
<library-ref>
    <library-name>dom4j</library-name>
</library-ref>
<library-ref>
    <library-name>hibernate-commons-annotations</library-name>
</library-ref>
<library-ref>
    <library-name>jboss-logging</library-name>
</library-ref>
<library-ref>
    <library-name>jboss-logging-annotations</library-name>
</library-ref>
<library-ref>
    <library-name>jandex</library-name>
</library-ref>
<library-ref>
    <library-name>javassist</library-name>
</library-ref>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM