[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3780?page=c...
]
Julien Kronegg commented on HHH-3780:
-------------------------------------
According to
http://upcommons.upc.edu/pfc/bitstream/2099.1/5183/1/JDBC%20DatabaseMetaD...,
the table types are:
MySQL
<AvailableTableTypes>
<type>TABLE</type>
<type>VIEW</type>
<type>LOCAL TEMPORARY</type>
</AvailableTableTypes>
DB2
<AvailableTableTypes>
<type>ALIAS</type>
<type>HIERARCHY TABLE</type>
<type>INOPERATIVE VIEW</type>
<type>MATERIALIZED QUERY TABLE</type>
<type>NICKNAME</type>
<type>SYSTEM TABLE</type>
<type>TABLE</type>
<type>TYPED TABLE</type>
<type>TYPED VIEW</type>
<type>VIEW</type>
</AvailableTableTypes>
Oracle
<AvailableTableTypes>
<type>TABLE</type>
<type>VIEW</type>
<type>SYNONYM</type>
</AvailableTableTypes>
SQL Server
<AvailableTableTypes>
<type>SYSTEM TABLE</type>
<type>TABLE</type>
<type>VIEW</type>
</AvailableTableTypes>
It seems that IBM's DB2 is the most special case. Maybe is it worth to add the other
DB2 types which falls down to the notion of TABLE in hibernate...
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=/cl...
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira