简体   繁体   中英

Hibernate, WebLogic 10.3 and JPA 2.0

I created an application using Spring 4.0, Hibernate 4.3 and JPA 2.1. Unfortunately, last minute I realized that the server we are using does not support JPA 2.1 (WebLogic 10.3.6).

Note that I have no control over the server that we are using - I can't upgrade it to a higher version. Also, I know that I should have been more aware of what we were using; however, I cannot change that now. It will be a lessons learned for the future.

I am in a dilemma now, in that the customer has seen a working version locally and expects the application to be deployed onto the web server shortly. I realized that I need to rewrite large portions of the data persistence layer.

Could any of you help me identify what areas are different between Hibernate 4.2.8 and Hibernate 4.3, as well as the difference between JPA 2.1? I know this is a large question, but I don't have another point of reference to help in my organization. I'm hoping I can get some guidance here.

As of this point, I believe that the following areas are impacted by reverting to the earlier versions:

  • JPA Tables
  • JPA Join Indexes
  • Some autowiring
  • Some annotations

I know there are several other issues but am finding them as I fix the other issues. One of the biggest problems I have are the joins, as I have many bi-directional relationships using @ManyToOne and join columns.

My question is: What are some capabilities that are commonly using in Hibernate 4.3 that do not exist in Hibernate 4.2.x? What capabilities are not supported without JPA 2.1? Do you think that the differences are great enough to necessitate a rewrite of the current data persistence layer from scratch?

If this is too large a question, please let me know and I will try to refine it further.

Thank you in advance for your help.

We had the same problem on weblogic 12. Our app uses hibernate/JPA 2.1 and it conflicts with JPA 2.0 that weblogc 12 provides.

You can use the WebLogic Classloader Analysis Tool (also called wls-cat ) to identify all conflicts between the WLS libraries and your application.

The solution is to tell weblogic not to use the old frameworks it bundles along.

In my case i am deploying a war that contains hibernate and the JPA 2.1 API.

Create WEB-INF/weblogic.xml

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app
  xmlns:wls="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/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
  <wls:container-descriptor>
    <wls:prefer-application-packages>
      <wls:package-name>org.slf4j</wls:package-name>
      <wls:package-name>org.joda</wls:package-name>
      <wls:package-name>javax.persistence</wls:package-name>
    </wls:prefer-application-packages>
  </wls:container-descriptor>
</wls:weblogic-web-app>

It would be great if there was a way to tell weblogic to use all the libraries in the WAR and never use it's old copies of the libraries.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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