Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-4941

HHH-5017 "SettingsFactory" no longer checks for presence of "supportsGetGeneratedKeys" before calling it

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • TBD
    • EAP 5.0.1
    • Hibernate
    • None
    • Not Required

      ===
      A number of users are experiencing Hibernate failures when using various combinations of Oracle JDBC driver versions and JDK versions. A sample stacktrace is below:

      Initial SessionFactory Creaion Failed.java.lang.AbstractMethodError: oracle.jdbc.driver.OracleDatabaseMetaData.supportsGetGeneratedKeys()Z
      Exception in thread "main" java.lang.ExceptionInInitializerError
      at HibernateUtil.buildSessionFactory(HibernateUtil.java:27)
      at HibernateUtil.<clinit>(HibernateUtil.java:17)
      at EvenManager.createAndStoreEvent(EvenManager.java:33)
      at EvenManager.main(EvenManager.java:26)
      Caused by: java.lang.AbstractMethodError: oracle.jdbc.driver.OracleDatabaseMetaData.supportsGetGeneratedKeys()Z
      at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:123)
      at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119)
      at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2115)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1339)
      at HibernateUtil.buildSessionFactory(HibernateUtil.java:23)
      ... 3 more

      The basic issue is that the "supportsGetGeneratedKeys" method does not exist on the "oracle.jdbc.driver.OracleDatabaseMetaData" JDBC driver class for many versions of Oracle. Even if you use the "hibernate.jdbc.use_get_generated_keys" config property, Hibernate still makes a call to that method and execution still fails.

      Up until version 3.2.7.GA of Hibernate, the code checked for the presence of "supportsGetGeneratedKeys" prior to calling it. The problem emerged with version 3.3.2.GA, where now Hibernate just calls the method without first verifying that it exists. If there was no functional reason for removing this safety-check, can we please re-insert it to prevent such failures?

      A discussion of this issue can be found on the forums at: https://forum.hibernate.org/viewtopic.php?f=1&t=1002210&p=2427193#p2427193
      ===

              shaozliu Strong Liu(刘少壮) (Inactive)
              sjmenden_jira Samuel Mendenhall (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: