I have a table that has several million records.  I need to get the
ids of all the records.  My HQL query looks like

select m.Key from MyTable m where m.Status = 1.

The problem is that I am getting System.OutOfMemory exception in
nHibernate.

All I want is an array of all the ids.  Any ideas on how to do it.  I
have tried using the combination of SetFirstResult and SetMaxcResults
in the past to page through the result and found out that when the
same query is executed, the rownum statments generated by nhibernate
did not provide the expected result.

Anyway, I woudl really appreciate is if somebody could provide soem
sugegstions.

The exact stack trace is below.

////////////////////////////////// Stack
Trace /////////////////////////////////////
StackTrace:
       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(String query,
QueryParameters queryParameters, IList results)
       at NHibernate.Impl.SessionImpl.List[T](String query,
QueryParameters parameters)
       at NHibernate.Impl.QueryImpl.List[T]()
       at
Brierley.FrameWork.Data.DataAccess.MemberDAO.RetrieveIds(String alias,
EvaluatedCriterion whereClause, String orderByClause, LWQueryBatchInfo
batchInfo) in C:\ProductDevelopment\LoyaltyWare\Main\Framework
\Brierley.FrameWork\Data\DataAccess\Impl\MemberDAO.cs:line 564
       at
CompositionAopProxy_b9a591665b6e46d3b0640abba3153f59.RetrieveIds(String
alias, EvaluatedCriterion whereClause, String orderByClause,
LWQueryBatchInfo batchInfo)
       at
Brierley.FrameWork.Data.LWDataService.GetAllMemberIds(LWCriterion
criteria, LWQueryBatchInfo batchInfo) in C:\ProductDevelopment
\LoyaltyWare\Main\Framework\Brierley.FrameWork\Data
\LWDataService.cs:line 4262
       at
CompositionAopProxy_87382effc8714ead88a14b6e1719da3f.GetAllMemberIds(LWCriterion
criteria, LWQueryBatchInfo batchInfo)
       at
_dynamic_CompositionAopProxy_87382effc8714ead88a14b6e1719da3f.GetAllMemberIds(Object
 ,
Object[] )
       at Spring.Reflection.Dynamic.SafeMethod.Invoke(Object target,
Object[] arguments)
       at
Spring.Aop.Framework.DynamicMethodInvocation.InvokeJoinpoint()
       at Spring.Aop.Framework.AbstractMethodInvocation.Proceed()
       at
Spring.Aspects.Logging.AbstractLoggingAdvice.Invoke(IMethodInvocation
invocation)
       at Spring.Aop.Framework.AbstractMethodInvocation.Proceed()
       at Spring.Aop.Framework.DynamicProxy.AdvisedProxy.Invoke(Object
proxy, Object target, Type targetType, MethodInfo targetMethod,
MethodInfo proxyMethod, Object[] args, IList interceptors)
       at
CompositionAopProxy_238bbd8f956a42a893432b5843bff40c.GetAllMemberIds(LWCriterion
criteria, LWQueryBatchInfo batchInfo)
       at
CompositionAopProxy_b3030c49942947b9868a78788b43578f.GetAllMemberIds(LWCriterion
criteria, LWQueryBatchInfo batchInfo)
       at
Brierley.LoyaltyWare.RulesProcessor.Retrievers.AttributeSetRetrievers.CriteriaBasedMemberRetriever.HasMoreMembers()
in C:\ProductDevelopment\LoyaltyWare\Main\LWIntegrationSvc
\Brierley.LoyaltyWare.RulesProcessor\Retrievers\MemberRetrievers
\CriteriaBasedMemberRetriever.cs:line 58
       at
Brierley.LoyaltyWare.RulesProcessor.Retrievers.AttributeSetRetrievers.CriteriaBasedMemberRetriever.GetNextEntity()
in C:\ProductDevelopment\LoyaltyWare\Main\LWIntegrationSvc
\Brierley.LoyaltyWare.RulesProcessor\Retrievers\MemberRetrievers
\CriteriaBasedMemberRetriever.cs:line 109
       at Brierley.LoyaltyWare.RulesProcessor.RuleProcessor.Process()
in C:\ProductDevelopment\LoyaltyWare\Main\LWIntegrationSvc
\Brierley.LoyaltyWare.RulesProcessor\RuleProcessor.cs:line 191
       at LWRulesProcessor.Program.ExecuteRules(String configFile,
Int64 jobNumber, String jobName, Boolean debug) in C:
\ProductDevelopment\LoyaltyWare\Main\LWIntegrationSvc\LWRulesProcessor
\Program.cs:line 58
       at LWRulesProcessor.Program.Main(String[] args) in C:
\ProductDevelopment\LoyaltyWare\Main\LWIntegrationSvc\LWRulesProcessor
\Program.cs:line 51
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly,
String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
       at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object
state)
       at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.OutOfMemoryException
       Message=Exception of type 'System.OutOfMemoryException' was
thrown.
       Source=mscorlib
       StackTrace:
            at System.String.Concat(String str0, String str1)
            at System.String.Concat(Object arg0, Object arg1)
            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)
       InnerException:

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to