2

我的 log4j 中有 Hibernate 的调试输出,这是堆栈跟踪

127946 DEBUG org.hibernate.hql.internal.ast.ErrorCounter - throwQueryException() : no errors
127962 DEBUG org.hibernate.hql.internal.ast.QueryTranslatorImpl - HQL: select distinct u from edu.harvard.fas.aurora.datagrid.domain.UserPreferenceDatagrid u where u.userId = :userId and u.d
atagridName = :datagridName
127962 DEBUG org.hibernate.hql.internal.ast.QueryTranslatorImpl - SQL: select distinct userprefer0_.ID as ID26_, userprefer0_.CREATED_BY as CREATED2_26_, userprefer0_.CREATED_DATE as CREATED
3_26_, userprefer0_.UPDATED_BY as UPDATED4_26_, userprefer0_.UPDATED_DATE as UPDATED5_26_, userprefer0_.DATAGRID_NAME as DATAGRID6_26_, userprefer0_.USER_ID as USER7_26_ from AURORA_DATA.USE
R_PREFERENCE_DATAGRID userprefer0_ where userprefer0_.USER_ID=? and userprefer0_.DATAGRID_NAME=?
127962 DEBUG org.hibernate.hql.internal.ast.ErrorCounter - throwQueryException() : no errors
129724 DEBUG org.hibernate.SQL -
    select
        distinct userprefer0_.ID as ID26_,
        userprefer0_.CREATED_BY as CREATED2_26_,
        userprefer0_.CREATED_DATE as CREATED3_26_,
        userprefer0_.UPDATED_BY as UPDATED4_26_,
        userprefer0_.UPDATED_DATE as UPDATED5_26_,
        userprefer0_.DATAGRID_NAME as DATAGRID6_26_,
        userprefer0_.USER_ID as USER7_26_
    from
        AURORA_DATA.USER_PREFERENCE_DATAGRID userprefer0_
    where
        userprefer0_.USER_ID=?
        and userprefer0_.DATAGRID_NAME=?
129724 DEBUG org.hibernate.loader.Loader - Result set row: 0
129740 DEBUG org.hibernate.loader.Loader - Result row: EntityKey[edu.harvard.fas.aurora.datagrid.domain.UserPreferenceDatagrid#3350]
129740 DEBUG org.hibernate.engine.internal.TwoPhaseLoad - Resolving associations for [edu.harvard.fas.aurora.datagrid.domain.UserPreferenceDatagrid#3350]
129740 DEBUG org.hibernate.engine.internal.TwoPhaseLoad - Done materializing entity [edu.harvard.fas.aurora.datagrid.domain.UserPreferenceDatagrid#3350]
129740 DEBUG org.hibernate.engine.internal.StatefulPersistenceContext - Initializing non-lazy collections
129740 DEBUG org.hibernate.loader.Loader - Loading collection: [edu.harvard.fas.aurora.datagrid.domain.UserPreferenceDatagrid.columns#3350]
129755 DEBUG org.hibernate.SQL -
    select
        columns0_.USER_PREFERENCE_DATAGRID_ID as USER1_26_2_,
        columns0_.columns_ID as columns2_2_,
        userprefer1_.ID as ID29_0_,
        userprefer1_.CREATED_BY as CREATED2_29_0_,
        userprefer1_.CREATED_DATE as CREATED3_29_0_,
        userprefer1_.UPDATED_BY as UPDATED4_29_0_,
        userprefer1_.UPDATED_DATE as UPDATED5_29_0_,
        userprefer1_.COLUMN_NAME as COLUMN6_29_0_,
        userprefer1_.SORT_ORDER as SORT7_29_0_,
        userprefer1_.USER_PREFERENCE_DATAGRID_ID as USER8_29_0_,
        userprefer2_.ID as ID26_1_,
        userprefer2_.CREATED_BY as CREATED2_26_1_,
        userprefer2_.CREATED_DATE as CREATED3_26_1_,
        userprefer2_.UPDATED_BY as UPDATED4_26_1_,
        userprefer2_.UPDATED_DATE as UPDATED5_26_1_,
        userprefer2_.DATAGRID_NAME as DATAGRID6_26_1_,
        userprefer2_.USER_ID as USER7_26_1_
    from
        AURORA_DATA.USER_PREFERENCE_DATAGRID_USER_PREFERENCE_DATAGRID_COL columns0_
    inner join
        AURORA_DATA.USER_PREFERENCE_DATAGRID_COL userprefer1_
            on columns0_.columns_ID=userprefer1_.ID
    left outer join
        AURORA_DATA.USER_PREFERENCE_DATAGRID userprefer2_
            on userprefer1_.USER_PREFERENCE_DATAGRID_ID=userprefer2_.ID
    where
        columns0_.USER_PREFERENCE_DATAGRID_ID=?
129771 DEBUG org.hibernate.engine.jdbc.spi.SqlExceptionHelper - ORA-00972: identifier is too long
 [n/a]
java.sql.SQLSyntaxErrorException: ORA-00972: identifier is too long

        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
        at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
        at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
        at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
        at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
        at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
        at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:884)
        at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1167)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1289)
        at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584)
        at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3628)
        at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1493)
        at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
        at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
        at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122)
        at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
        at $Proxy50.executeQuery(Unknown Source)
        at org.hibernate.loader.Loader.getResultSet(Loader.java:1962)
        at org.hibernate.loader.Loader.doQuery(Loader.java:829)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:289)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
        at org.hibernate.loader.Loader.loadCollection(Loader.java:2159)
        at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:61)
        at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:622)
        at org.hibernate.event.internal.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:82)
        at org.hibernate.internal.SessionImpl.initializeCollection(SessionImpl.java:1718)
        at org.hibernate.collection.internal.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:489)
        at org.hibernate.engine.internal.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:930)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:294)
        at org.hibernate.loader.Loader.doList(Loader.java:2447)
        at org.hibernate.loader.Loader.doList(Loader.java:2433)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2263)
        at org.hibernate.loader.Loader.list(Loader.java:2258)
        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:470)
        at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:355)
        at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:196)
        at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1161)
        at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)
        at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:252)
        at edu.harvard.fas.aurora.userpreferencedatagrid.dao.UserPreferenceDatagridDAOJpaImpl.storeUserPreferenceDataGrid(UserPreferenceDatagridDAOJpaImpl.java:37)
        at edu.harvard.fas.aurora.userpreferencedatagrid.service.UserPreferenceDatagridServiceImpl.storeUserPreferenceDatagrid(UserPreferenceDatagridServiceImpl.java:25)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy34.storeUserPreferenceDatagrid(Unknown Source)
        at edu.harvard.fas.aurora.arrangedlist.controller.ArrangedListController.saveArngDlgData(ArrangedListController.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:212)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
        at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:306)
        at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:323)
        at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1719)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
129787 WARN  org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL Error: 972, SQLState: 42000
129787 ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - ORA-00972: identifier is too long
4

2 回答 2

3

我可以在您的错误中看到:

from
        AURORA_DATA.USER_PREFERENCE_DATAGRID_USER_PREFERENCE_DATAGRID_COL

该表名超过 30 个字符(在 oracle 上,表 + 列不能超过 30 个字符)

SQL> select * from
  2   AURORA_DATA.USER_PREFERENCE_DATAGRID_USER_PREFERENCE_DATAGRID_COL
  3  /
        AURORA_DATA.USER_PREFERENCE_DATAGRID_USER_PREFERENCE_DATAGRID_COL
                    *
ERROR at line 2:
ORA-00972: identifier is too long
于 2013-01-03T21:42:20.470 回答
3

该错误具有误导性,或者我还没有找到完全识别问题的方法。好吧,当我在父表上放置 @JoinColumn 时它就消失了,孩子有一个 @JoinColumn 但父母没有。

于 2013-01-05T14:50:37.740 回答