Correction: UniqueResult instead of SingleResult() and with such info, i am not able to help you further than tihs.
Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Wed, Aug 19, 2009 at 5:57 PM, Tuna Toksoz <[email protected]> wrote: > just a thing: you don't have to fetch the whole table.Use prjection to get > count. > > return ((int)session.CreateCriteria(typeof(Table1)) > .Add(Expression.Eq("Property1", para)) > .SetProjection(Projections.Count("Id")) > .SingleResult())>0 > > > Tuna Toksöz > Eternal sunshine of the open source mind. > > http://devlicio.us/blogs/tuna_toksoz > http://tunatoksoz.com > http://twitter.com/tehlike > > > > > On Wed, Aug 19, 2009 at 5:49 PM, NHibernate1 <[email protected]>wrote: > >> >> Hi Tuna , >> >> Thanks for the quick response . Nope :( stcik to 1.2 only . Below is >> the code in short : >> >> Func1(ObjId) >> { >> .... >> >> Func2(ObjId) >> ..... >> >> } >> >> Func2(ObjId) >> { >> .... >> >> Func3(ObjId) >> ..... >> >> } >> >> Func2(ObjId) >> { >> .... >> >> if(NHFunc(parameter1)) >> .... >> if(NHFunc(parameter2)) >> ............ >> ..... >> >> } >> >> NHFunc(parameter para) >> { >> IList<Table1> results = session.CreateCriteria(typeof(Table1)) >> .Add(Expression.Eq("Property1", para)) >> .List<Table1>(); >> return results.count>0; >> } >> >> My Application invokes Func1() -1st time with a uniqueID -ObjId1 >> pointing to Table1 and i get expected o/p. >> when My Application invokes Func1() -2nd time with different uniqueID - >> ObjId2 pointing to Table1 and i get expected o/p. >> but when My Application invokes Func1() -say 3rd or 4th time with >> uniqueID -ObjId1 pointing to Table1 and i get Error >> >> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
