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

HHH-1329 - Views not supported by schema validation

    XMLWordPrintable

Details

    • Release Notes

    Description

      We want to map an EJB entity to a database view (using Oracle 10g) in order to address a problem in Production without making a coding change. However, when we start up JBoss, we get a validation error, "Cannot find table ...". We are using the out-of-the-box version of Hibernate (3.2.4-sp1) and have found the problem to be Line 49 of org.hibernate.tool.hbm2ddl.DatabaseMetadata

      private static final String[] TYPES =

      {"TABLE"}

      ;
      is the problem. This gets passed into java.sql.DatabaseMetadata.getTables(catalog, schema, tableName, TYPES);

      our implementation of java.sql.DatabaseMetadata is orable.jdbc.driver.OracleDatabaseMetaData

      If you pass in

      {"TABLE", "VIEW"} then the method returns the correct value... but with the hard coded "TABLE" it does not.

      The following code returns the info about the table... adding "VIEW" makes it work

      public static void main(String[] args) throws Exception {
      Class.forName ("oracle.jdbc.driver.OracleDriver");
      Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:aquina/testbed11@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=endevdb02.enernoc.net)(PORT=1521))(FAILOVER=on)(LOAD_BALANCE=on)(CONNECT_DATA=(SERVICE_NAME=fusdev)))");
      OracleDatabaseMetaData meta = new OracleDatabaseMetaData((OracleConnection)conn);
      String[] TYPES = {"TABLE", "VIEW"}

      ;
      ResultSet rs = meta.getTables("", "AQUINA", "ACTION_UNIT_VIEW", TYPES);
      if (rs.next())

      { System.out.println(rs.getString("TABLE_NAME")); }

      }

      We have noted that this has in fact changed in the latest version of Hibernate (3.3.1.GA).

      Attachments

        Issue Links

          Activity

            People

              gbadner@redhat.com Gail Badner (Inactive)
              apatrici Anthony Patricio
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: