[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3780) DB2 materialized views are not retrieved in DatabaseMetadata

Julien Kronegg (JIRA) noreply at atlassian.com
Thu Feb 26 09:19:40 EST 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32515#action_32515 ] 

Julien Kronegg commented on HHH-3780:
-------------------------------------

Same problem in Hibernate tools, see processTables(..) method in http://anonsvn.jboss.org/repos/hibernate/branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/JDBCReader.java

> DB2 materialized views are not retrieved in DatabaseMetadata
> ------------------------------------------------------------
>
>                 Key: HHH-3780
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3780
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.1
>         Environment: Hibernate 3.3.1.GA
>            Reporter: Julien Kronegg
>            Priority: Minor
>   Original Estimate: 3 hours
>  Remaining Estimate: 3 hours
>
> The class org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata() gets the table with the specified name and restricts the type to either "TABLE" or "VIEW" (see TYPES constant).
> Consequently, DB2 materialized view tables cannot be retrieved because their type is "MATERIALIZED QUERY TABLE", i.e. neither "TABLE" nor "VIEW".
> Note: for a full list of DB2 types, see http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/cli/rzadpfntabls.htm
> or use the following code snippet:
>     Connection con = ... // a connection to a DB2 database
>     ResultSet rs = con.getMetaData().getTableTypes();
>     while (rs.next()) {
>       System.out.println(rs.getObject(1));
>     }
> A similar problem occured for views before: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1329
> Two solutions:
>  1) add "MATERIALIZED QUERY TABLE" in the org.hibernate.tool.hbm2ddl.DatabaseMetadata.TYPES constant.
>  2) change Hibernate FAQ by http://www.hibernate.org/116.html#A28 by adding a note about materialized views under DB2
> Solution (1) would be better IMHO.
> Workaround: since the hibernate tools cannot get the table structure from the metadata (e.g. when using seam-gen), it is required to write the mapping file by hand.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list