[
http://opensource.atlassian.com/projects/hibernate/browse/HBX-609?page=co...
]
Brian Hayward commented on HBX-609:
-----------------------------------
From what I've read, it looks like this logic is only used for
validation purposes.
Correct me if I'm wrong here.
Many organizations use multiple schemas rather than separate databases with Oracle.
In scenarios like this, turning on validation isn't very useful.
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira