[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3780) DB2 materialized views are not retrieved in DatabaseMetadata
Julien Kronegg (JIRA)
noreply at atlassian.com
Tue Feb 24 08:24:38 EST 2009
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
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