[jboss-jira] [JBoss JIRA] Created: (HIBERNATE-105) Hibernate tools on Oralce - update causes problems - table name conflicts

Anders Monrad (JIRA) jira-events at lists.jboss.org
Thu Sep 18 07:24:21 EDT 2008


Hibernate tools on Oralce - update causes problems - table name conflicts
-------------------------------------------------------------------------

                 Key: HIBERNATE-105
                 URL: https://jira.jboss.org/jira/browse/HIBERNATE-105
             Project: Hibernate
          Issue Type: Bug
         Environment: [hibernatetool]  INFO [main] (Version.java:15) - Hibernate EntityManager 3.2.1.GA
[hibernatetool]  INFO [main] (Version.java:15) - Hibernate Annotations 3.2.1.GA
[hibernatetool]  INFO [main] (Environment.java:514) - Hibernate 3.2.4.sp1.cp03

Oracle 10g


            Reporter: Anders Monrad
            Assignee: Steve Ebersole


When we try to do an update on our schema after changing something we get a ORA-01031: insufficient privileges error from Oracle (see exception at the bottom ).

This seems to happen trying to get some metadata on the CPA.PRODUCT table.
After investigating this, I found out that we in the Oracle database had another table in another schema called PRODUCT (AHD.PRODUCT), which is granted to public, and therefore visible to our user (CPA). 

If I remove the public grant on this table, the update works.

In our persistence.xml setup we have both
         <property name="hibernate.Schema" value="CPA" />
         <property name="hibernate.default_schema" value="CPA"/>
And all statements printed in debug indicate that this is picked up eg. "table found: CPA.ENZYMETYPE"

It seems that the schema in not used in all queries executed by the hibernatetool. Specifically this seems to happen when calling  DatabaseMetaData.getIndexInfo()

[hibernatetool] DEBUG [main] (JDBCExceptionReporter.java:69) - could not get table metadata: Product [???]
[hibernatetool] java.sql.SQLException: ORA-01031: insufficient privileges
[hibernatetool] 	at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
[hibernatetool] 	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
[hibernatetool] 	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
[hibernatetool] 	at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
[hibernatetool] 	at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:112)
[hibernatetool] 	at oracle.jdbc.driver.T4CStatement.execute_for_rows(T4CStatement.java:474)
[hibernatetool] 	at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1028)
[hibernatetool] 	at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1451)
[hibernatetool] 	at oracle.jdbc.OracleDatabaseMetaData.getIndexInfo(OracleDatabaseMetaData.java:3271)
[hibernatetool] 	at org.hibernate.tool.hbm2ddl.TableMetadata.initIndexes(TableMetadata.java:130)
[hibernatetool] 	at org.hibernate.tool.hbm2ddl.TableMetadata.<init>(TableMetadata.java:35)
[hibernatetool] 	at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(DatabaseMetadata.java:90)
[hibernatetool] 	at org.hibernate.cfg.Configuration.generateSchemaUpdateScript(Configuration.java:991)
[hibernatetool] 	at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:140)
[hibernatetool] 	at org.hibernate.tool.hbm2x.Hbm2DDLExporter.doStart(Hbm2DDLExporter.java:77)
[hibernatetool] 	at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
[hibernatetool] 	at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)
[hibernatetool] 	at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:186)
[hibernatetool] 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[hibernatetool] 	at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[hibernatetool] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[hibernatetool] 	at java.lang.reflect.Method.invoke(Method.java:585)
[hibernatetool] 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[hibernatetool] 	at org.apache.tools.ant.Task.perform(Task.java:348)
[hibernatetool] 	at org.apache.tools.ant.Target.execute(Target.java:357)
[hibernatetool] 	at org.apache.tools.ant.Target.performTasks(Target.java:385)
[hibernatetool] 	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
[hibernatetool] 	at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
[hibernatetool] 	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[hibernatetool] 	at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[hibernatetool] 	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
[hibernatetool] 	at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
[hibernatetool] 	at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
[hibernatetool]  WARN [main] (JDBCExceptionReporter.java:77) - SQL Error: 1031, SQLState: 42000
[hibernatetool] ERROR [main] (JDBCExceptionReporter.java:78) - ORA-01031: insufficient privileges
[hibernatetool] ERROR [main] (SchemaUpdate.java:165) - could not complete schema update
[hibernatetool] org.hibernate.exception.SQLGrammarException: could not get table metadata: Product
[hibernatetool] 	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
[hibernatetool] 	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
[hibernatetool] 	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
[hibernatetool] 	at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(DatabaseMetadata.java:105)
[hibernatetool] 	at org.hibernate.cfg.Configuration.generateSchemaUpdateScript(Configuration.java:991)
[hibernatetool] 	at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:140)
[hibernatetool] 	at org.hibernate.tool.hbm2x.Hbm2DDLExporter.doStart(Hbm2DDLExporter.java:77)
[hibernatetool] 	at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
[hibernatetool] 	at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)
[hibernatetool] 	at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:186)
[hibernatetool] 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[hibernatetool] 	at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[hibernatetool] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[hibernatetool] 	at java.lang.reflect.Method.invoke(Method.java:585)
[hibernatetool] 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[hibernatetool] 	at org.apache.tools.ant.Task.perform(Task.java:348)
[hibernatetool] 	at org.apache.tools.ant.Target.execute(Target.java:357)
[hibernatetool] 	at org.apache.tools.ant.Target.performTasks(Target.java:385)
[hibernatetool] 	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
[hibernatetool] 	at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
[hibernatetool] 	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[hibernatetool] 	at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[hibernatetool] 	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
[hibernatetool] 	at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
[hibernatetool] 	at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
[hibernatetool] Caused by: java.sql.SQLException: ORA-01031: insufficient privileges
[hibernatetool] 	at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
[hibernatetool] 	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
[hibernatetool] 	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
[hibernatetool] 	at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
[hibernatetool] 	at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:112)
[hibernatetool] 	at oracle.jdbc.driver.T4CStatement.execute_for_rows(T4CStatement.java:474)
[hibernatetool] 	at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1028)
[hibernatetool] 	at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1451)
[hibernatetool] 	at oracle.jdbc.OracleDatabaseMetaData.getIndexInfo(OracleDatabaseMetaData.java:3271)
[hibernatetool] 	at org.hibernate.tool.hbm2ddl.TableMetadata.initIndexes(TableMetadata.java:130)
[hibernatetool] 	at org.hibernate.tool.hbm2ddl.TableMetadata.<init>(TableMetadata.java:35)
[hibernatetool] 	at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(DatabaseMetadata.java:90)
[hibernatetool] 	... 21 more


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list