gpt4 book ai didi

c# - 第一次尝试使用 NHibernate 对 Oracle 执行查询时获取 'could not execute query'

转载 作者:行者123 更新时间:2023-11-30 17:44:32 24 4
gpt4 key购买 nike

我正在使用的系统的一些背景知识:

这是一个企业系统,拥有一个包含大约 500 个表的 Oracle 数据库,目前我们在 NHibernate 中映射了大约 400 个表。

我们正在运行 Oracle 11。

代码是用 C# 编写的,运行在 .Net 3.5 上。

我们使用的是 NHibernate 版本:3.3.1.4000。

现在解决问题:

在授权逻辑中,我们首先设置了 NHibernate SessionFactory,这大约需要 1 分钟,之后我们对数据库进行了第一次调用,并在此处出现错误:

could not execute query
[ select USERID353_,OBJVERSION353_,FIRSTNAME353_,LASTNAME353_,DEPARTMENT353_,USERINIT6_353_,INTERNAL7_353_,MEMODIST8_353_,EMAILADD9_353_,USERCOM10_353_,DELETED353_,ADDRESS353_,DEFAULT13_353_ from ( select sprintuser0_.USERID as USERID353_, sprintuser0_.OBJVERSION as OBJVERSION353_, sprintuser0_.FIRSTNAME as FIRSTNAME353_, sprintuser0_.LASTNAME as LASTNAME353_, sprintuser0_.DEPARTMENT as DEPARTMENT353_, sprintuser0_.USERINITIALS as USERINIT6_353_, sprintuser0_.INTERNALADDRESS as INTERNAL7_353_, sprintuser0_.MEMODISTRIBUTIONGROUP as MEMODIST8_353_, sprintuser0_.EMAILADDRESS as EMAILADD9_353_, sprintuser0_.USERCOMMENT as USERCOM10_353_, sprintuser0_.DELETED as DELETED353_, sprintuser0_.ADDRESS as ADDRESS353_, sprintuser0_.DEFAULTRESPONSIBILITYAREAOID as DEFAULT13_353_ from SPRINTUSER sprintuser0_ where sprintuser0_.USERID=:p0 ) where rownum <=1 ]
Name:p1 - Value:V0C0359
[SQL: select USERID353_,OBJVERSION353_,FIRSTNAME353_,LASTNAME353_,DEPARTMENT353_,USERINIT6_353_,INTERNAL7_353_,MEMODIST8_353_,EMAILADD9_353_,USERCOM10_353_,DELETED353_,ADDRESS353_,DEFAULT13_353_ from ( select sprintuser0_.USERID as USERID353_, sprintuser0_.OBJVERSION as OBJVERSION353_, sprintuser0_.FIRSTNAME as FIRSTNAME353_, sprintuser0_.LASTNAME as LASTNAME353_, sprintuser0_.DEPARTMENT as DEPARTMENT353_, sprintuser0_.USERINITIALS as USERINIT6_353_, sprintuser0_.INTERNALADDRESS as INTERNAL7_353_, sprintuser0_.MEMODISTRIBUTIONGROUP as MEMODIST8_353_, sprintuser0_.EMAILADDRESS as EMAILADD9_353_, sprintuser0_.USERCOMMENT as USERCOM10_353_, sprintuser0_.DELETED as DELETED353_, sprintuser0_.ADDRESS as ADDRESS353_, sprintuser0_.DEFAULTRESPONSIBILITYAREAOID as DEFAULT13_353_ from SPRINTUSER sprintuser0_ where sprintuser0_.USERID=:p0 ) where rownum <=1]
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes)
at NHibernate.Hql.Ast.ANTLR.Loader.QueryLoader.List(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.List(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters queryParameters, ISessionImplementor session, IList results)
at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results)
at NHibernate.Impl.AbstractSessionImpl.List(IQueryExpression queryExpression, QueryParameters parameters)
at NHibernate.Impl.ExpressionQueryImpl.List()
at NHibernate.Linq.DefaultQueryProvider.ExecuteQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
at NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression)
at NHibernate.Linq.DefaultQueryProvider.Execute[TResult](Expression expression)
at System.Linq.Queryable.Any[TSource](IQueryable`1 source)
at t916DataRepository.t916Common.SprintUserRespository.GetSprintUserEagerly(String userId) in c:\Builds\30\14\Sources\Server\t916DataRepository\t916Common\SprintUserRespository.cs:line 17
at t916Common.com.common.authorization.AuthorizationMgr2.GetUserDataStructure(String userId)
at t916CommonService.Services.AuthorizationService.GetUserDataStructure2(String userId) in c:\Builds\30\14\Sources\Server\t916CommonService\Services\AuthorizationService.svc.cs:line 726
NHibernate
ORA-00028: your session has been killed
at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck)
at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, Boolean bCheck)
at Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior)
at Oracle.DataAccess.Client.OracleCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session)
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
Oracle Data Provider for .NET

如果我在大约一秒钟后尝试相同的操作,它就会成功。

这个错误只是偶尔发生。

最佳答案

内部异常会告诉您原因。

补充:通常,在处理 .Net 代码时,您必须始终以递归方式记录或检查所有内部异常。

关于c# - 第一次尝试使用 NHibernate 对 Oracle 执行查询时获取 'could not execute query',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29602781/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com