[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-609) SchemaUpdate with two identical DBs

Cedric Dandoy (JIRA) noreply at atlassian.com
Fri Apr 17 12:32:17 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HBX-609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32914#action_32914 ] 

Cedric Dandoy commented on HBX-609:
-----------------------------------

I think this is related to HIBERNATE-105 and HHH-3350
  https://jira.jboss.org/jira/browse/HIBERNATE-105
  http://opensource.atlassian.com/projects/hibernate/browse/HHH-3350


> SchemaUpdate with two identical DBs
> -----------------------------------
>
>                 Key: HBX-609
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-609
>             Project: Hibernate Tools
>          Issue Type: Bug
>         Environment: Hibernate 3.1.2, Oracle9i 9.2.0.5
>            Reporter: Maciej Wisniewski
>            Priority: Minor
>
> I have two Oracle users (A and B) on the same Oracle instance and trying to use one Hibernate application with schemaupdate (like in HHH-735) that creates all tables at first with user A and next with user B. The second failed with:
> <hibernate.util.JDBCExceptionReporter] could not get table metadata: BOOKMARK [???] java.sql.SQLException: ORA-01031: insufficient privileges
>  
> After an investigation I've found that the problem is that in constructor of class org.hibernate.tool.hbm2ddl.TableMetadata schema is always A (even when connecting to user B). This variable gets its value from resultset created by method getTables from interface DatabaseMetaData (it is called from Configuration.generateSchemaUpdateScript). Oracle's thin driver implements this as an SQL: 
> SELECT NULL AS table_cat,
>        o.owner AS table_schem,
>        o.object_name AS table_name,
>        o.object_type AS table_type,
>        NULL AS remarks
>   FROM all_objects o
>   WHERE o.owner LIKE ? ESCAPE '/'
>     AND o.object_name LIKE ? ESCAPE '/'
>     AND o.object_type IN ('xxx', 'TABLE')
>   ORDER BY table_type, table_schem, table_name
> where the first "?" is unfortunatelly "%". So that table_schem is always A, even when asking for a table that belongs to B.
> Later Hibernate uses this fetched schema name to pass it to method DatabaseMetaData.getIndexInfo and it fails because it does no have privillages to A's index info.

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