[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1329) SchemaValidator skips views on Oracle

Jörg Heinicke (JIRA) noreply at atlassian.com
Tue Nov 21 09:48:04 EST 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1329?page=comments#action_25383 ] 

Jörg Heinicke commented on HHH-1329:
------------------------------------

Just wondering why it takes one year to fix such a bug? Hibernate claims often enough that views are handled like tables (e.g. http://www.hibernate.org/116.html#A27), but that's just not true due to this bug. And it is a BUG, not only an improvement, even if it only occurs on schema validation.

Instead of
<class name="MyClass" table="MY_VIEW">
  ...
</class>

I have to write
<class name="MyClass" table="MY_VIEW">
  <subselect>select * from MY_VIEW</subselect>
  ...
</class>

I'm using IBM DB 2 btw, so it's no Oracle specific problem.

Jörg

> SchemaValidator skips views on Oracle
> -------------------------------------
>
>          Key: HHH-1329
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1329
>      Project: Hibernate3
>         Type: Improvement

>   Components: metamodel
>     Versions: 3.1
>  Environment: database: oracle9i
> hibernate: 3.1
> jdbc driver: ojdbc14-10.2.0.1.0
>     Reporter: Yariv Yaari

>
>
> All calls in org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata to java.sql.DatabaseMetaData.getTables set the fourth parameter (types) to {"TABLE"} (defined as a class-level constant).
> In the documentation of getTables it is not defined what are the meanings of the types passed as parameter, only that all the strings must be in java.sql.DatabaseMetaData.getTablesTypes return value. In oracle9i with ojdbc14-10.2.0.1.0.jar views are returned if types contains "VIEW" and not if its {"TABLE"}. It is a major problem only if hibernate.hbm2ddl.auto is set to validate, if it's set to update it will log some errors (since it can't create or alter the table, there is a view with this name) but it won't fail the deployment, and since in SQL views are treated as tables, there will be no more problems.
> It should be checked for more databases/jdbc drivers.
> It is not obvious what should be the solution.
> Pass {"TABLE","VIEW"} always? Pass them if they are in getTableTypes?
> Put it as part of the dialect, default to {"TABLE"} and change it in oreacle-dialects?

-- 
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