Hello,
I have a problem with hibernate
Hibernate version:
Hibernate Core 3.2.5.GA
Hibernate Annotations 3.3.0.GA
Hibernate EntityManager 3.3.1.GA
Full stack trace of any exception that occurs:
[2008-02-07 11:15:20,765] [http-0.0.0.0-8081-2] [INFO ] STDOUT: 11:15:20,765 INFO [SchemaUpdate] Running hbm2ddl schema update
[2008-02-07 11:15:20,765] [http-0.0.0.0-8081-2] [INFO ] STDOUT: 11:15:20,765 INFO [SchemaUpdate] fetching database metadata
[2008-02-07 11:15:20,781] [http-0.0.0.0-8081-2] [INFO ] STDOUT: 11:15:20,781 INFO [SchemaUpdate] updating schema
[2008-02-07 11:15:20,828] [http-0.0.0.0-8081-2] [INFO ] STDOUT: 11:15:20,828 WARN [JDBCExceptionReporter] SQL Error: 1031, SQLState: 42000
[2008-02-07 11:15:20,828] [http-0.0.0.0-8081-2] [INFO ] STDOUT: 11:15:20,828 ERROR [JDBCExceptionReporter] ORA-01031: insufficient privileges
[2008-02-07 11:15:20,828] [http-0.0.0.0-8081-2] [INFO ] STDOUT: 11:15:20,828 ERROR [SchemaUpdate] could not complete schema update
org.hibernate.exception.SQLGrammarException: could not get table metadata: RPT_COLUMN_REF
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(DatabaseMetadata.java:105)
at org.hibernate.cfg.Configuration.generateSchemaUpdateScript(Configuration.java:948)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:140)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:314)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:730)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
at com.siperian.reporting.server.db.DBAccess$DataSourceDescriptor.createEntityManagerFactory(DBAccess.java:138)
at com.siperian.reporting.server.db.DBAccess.reinit(DBAccess.java:45)
at com.siperian.reporting.server.facade.impl.ProjectFacadeImpl.connectToORS(ProjectFacadeImpl.java:268)
at com.siperian.reporting.server.facade.impl.ProjectFacadeImpl.saveOrUpdateProject(ProjectFacadeImpl.java:104)
at com.siperian.reporting.ui.beans.steps.FinalStep$JobSaveProject.jobBody(FinalStep.java:187)
at com.siperian.reporting.ui.beans.steps.FinalStep$1.body(FinalStep.java:94)
at com.siperian.reporting.ui.beans.steps.FinalStep$1.body(FinalStep.java:93)
at com.siperian.reporting.ui.beans.BackendAccess.callToBackend(BackendAccess.java:38)
at sun.reflect.GeneratedMethodAccessor609.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:47)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.interceptors.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:31)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
at com.siperian.reporting.ui.beans.BackendAccess_$$_javassist_2.callToBackend(BackendAccess_$$_javassist_2.java)
at com.siperian.reporting.ui.beans.steps.FinalStep.handleNextJobPressed(FinalStep.java:91)
at sun.reflect.GeneratedMethodAccessor620.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:47)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.interceptors.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:31)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
at com.siperian.reporting.ui.beans.steps.FinalStep_$$_javassist_11.handleNextJobPressed(FinalStep_$$_javassist_11.java)
at sun.reflect.GeneratedMethodAccessor619.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.el.parser.AstValue.invoke(AstValue.java:151)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
at javax.faces.component.UICommand.broadcast(UICommand.java:383)
at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:61)
at org.ajax4jsf.component.UIDataAdaptor.broadcast(UIDataAdaptor.java:1172)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextVa
[2008-02-07 11:15:20,828] [http-0.0.0.0-8081-2] [INFO ] STDOUT: lve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: ORA-01031: insufficient privileges
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:112)
at oracle.jdbc.driver.T4CStatement.execute_for_rows(T4CStatement.java:474)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1028)
at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1451)
at oracle.jdbc.OracleDatabaseMetaData.getIndexInfo(OracleDatabaseMetaData.java:3271)
at org.hibernate.tool.hbm2ddl.TableMetadata.initIndexes(TableMetadata.java:130)
at org.hibernate.tool.hbm2ddl.TableMetadata.<init>(TableMetadata.java:35)
at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(DatabaseMetadata.java:90)
... 100 more
Name and version of the database you are using:
Oracle 10gR2
I debugged hibernate and suppose that the following occured:
I have to schemas, let's take A_SCHEMA and B_SCHEMA. There are the same tables in both schemas for hibernate mapping, let's take one MY_TABLE. B_SCHEMA user has select right for A_SCHEMA.
I connect to B_SCHEMA and hibernate try to update its table MY_TABLE. DatabaseMetadata.getTableMetadata method look for this table and find A_SCHEMA.MY_TABLE and B_SCHEMA.MY_TABLE. But I did not provide schema name and hibernate take the first table in abc order, A_SCHEMA.MY_TABLE for this example - but I want to select B_SCHEMA.MY_TABEL.
Looking in hibernate I found that there is 2 ways to provide default schema: through xml mapping or annotations. But I don't know schema in compile time. So the question: how can I set default schema for hibernate?
I found bug that describes this situation:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2208
But it was fixed in old version...
Hibernate gurus, please help me to solve this.
Thank you.
Kirill.