3 Replies Latest reply on Feb 22, 2011 9:30 AM by jaikiran

    JBoss 4.2.2 / Hibernate 3.3.2 compatibility

    jbossbeginner

      Hello,

       

      I need to integrate some Oracle (11g) stored procedures in my application using Hibernate and JBoss 4.2.2.

      I got this exception:

      Caused by: org.hibernate.HibernateException: Problem while trying to load or access OracleTypes.CURSOR value

      ...

      The issue is similar to the one referenced on this forum:

      http://forums.oracle.com/forums/thread.jspa?messageID=4187843

       

      Jboss team has fix this with release 3.3.2 GA of Hibernate Core:

      http://opensource.atlassian.com/projects/hibernate/browse/HHH-3159

       

      As stated in the title, my problem concern the compatibility between JBoss 4.2.2 / Hibernate 3.3.2 GA, since I need to use Hibernate Core 3.3.2 GA to have the feature I need for Oracle stored procedures.

       

      By default, the folder $JBOSS_HOME/server/default/lib contains 3 Hibernate related jars:

       

       

      hibernate3.jar

      hibernate-annotations.jar

      hibernate-entitymanager.jar

      This last one depends on Hibernate Core: http://mvnrepository.com/artifact/org.hibernate/hibernate-entitymanager/3.4.0.GA

       

      If I replace those libraries with Hibernate Core 3.3.2 GA, Hibernate Annotation 3.3.1 GA and Hibernate Entity Manager 3.3.2 GA, as described on this compatibility matrix: http://community.jboss.org/wiki/HibernateCompatibilityMatrix , everything seems to be OK (apparently ) with JBoss 4.2.2.

       

      BUT, could I be 100% sure that there is no side effects if I replace these default lib?

      Does any one has already successfully made this kind of change in real production environment?

      Could I get objective advise from (senior) developer on this?

       

      Thanks in advance,

      Cheers,

      Tank.

        • 1. JBoss 4.2.2 / Hibernate 3.3.2 compatibility
          jaikiran

          A better option is to package the hibernate jars (of the version of your choice) within your application and not touch the ones shipped in JBoss AS. See if this helps http://jaitechwriteups.blogspot.com/2008/08/how-to-upgrade-hibernate-in-jboss.html

          1 of 1 people found this helpful
          • 2. JBoss 4.2.2 / Hibernate 3.3.2 compatibility
            jbossbeginner

            Thanks for your advice Jaikiran.

             

            I've folowed your tuto and adapted it to my needs for Hibernate 3.3.2.

             

            I got the following jar in the application package (based on official compatibility matrix mention before):

            MyApp.ear

            |

            |--- META-INF

            |     |

            |     |

            |     |--- application.xml

            |     |

            |     |--- jboss-app.xml

            |

            |

            | --- [some jar files required by my app]

            |

            | --- ejb3-persistence-1.0.2.GA.jar

            |

            | --- hibernate-annotations-3.4.0.GA.jar

            |

            | --- hibernate-commons-annotations-3.1.0.GA.jar

            |

            | --- hibernate-core-3.3.2.GA.jar

            |

            | --- hibernate-entitymanager-3.4.0.GA.jar

            |

            | --- hibernate-validator-3.1.0.GA.jar

            |

             

            The jboss-app.xml is generated using Maven ear plugin.

            It generate this:

            <jboss-app>

              <unauthenticated-principal>guest</unauthenticated-principal>

              <loader-repository>com.company:loader=MyApp.ear</loader-repository>

            </jboss-app>

             

            But I still got an exception:

            Problem starting service persistence.units:ear=...

            ...

            java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence cannot be cast to javax.persistence.spi.PersistenceProvider

                    at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:245)

                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            ...

             

            Do you know this exception?

            • 3. JBoss 4.2.2 / Hibernate 3.3.2 compatibility
              jaikiran

              What are the "other" jar files that you are packaging? Do you have jar file(s) in your application with contain javax.persistence.* classes? If yes, remove those jar files from your application packaging.