Print Page | Close Window

Getting error while fetching data

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=817
Printed Date: 11-Jun-2026 at 3:07am


Topic: Getting error while fetching data
Posted By: keval
Subject: Getting error while fetching data
Date Posted: 26-May-2008 at 4:48am
Hi,
 
I m getting following error while fetching records from database
 
Test method HETransactionsTests.QAccountSummaryTest.ExecuteActionBatch threw exception:  System.Exception: Execution of query against the server was successful but execution of query against the local cache failed System.NullReferenceException: Object reference not set to an instance of an object..
 
 
can u please guide about this error, why this happens?



Replies:
Posted By: kimj
Date Posted: 27-May-2008 at 10:25am
Keval, please post the query for which you received this exception.   Based on the QueryStrategy used, DevForce EF may first execute the query as a Linq to Entities query, and then again against the cache (to retrieve any local entities).  You may have run into a situation where the particular query was not supported against cache.  We've been trying to fix these types of problems, so hopefully yours will be fixed with the next beta.  Please post a snippet  of what you're doing so we can verify this.
 
Thanks.


Posted By: keval
Date Posted: 27-May-2008 at 9:44pm
Hi
Thanks for ur reply
 
Following is the Query that i m using and it gives me the same error for inserting,updating or retrieving

IEnumerable<ScheduledItem> scheduledItems = Dataset.ScheduledItems.ToList<ScheduledItem>();

 
And important thing is that i m facing problem for only one entity in whole model.
 
 


Posted By: kimj
Date Posted: 28-May-2008 at 9:38am
OK. 
 
So is Dataset your sub-typed EntityManager, and ScheduledItems a method returning an EntityQuery<ScheduledItem>?  How many items should be returned by the query?
 
You say you also get this exception when doing inserts or updates for entities of this type?  I'm not sure I follow you.  Does the exception occur when making the SaveChanges() call?
 
What is different about the ScheduledItem entity than other entities in your model?  Is in inherited from another entity?  Does it have a multi-column key?  Does it contain any complex types?  What kinds of associations does it have with other entities?  Can you post the csdl for this entity and for any associations it's a part of?
 
Can you also post the full exception, including stack trace and inner exception(s), received when you run the query above?
 
Thanks.


Posted By: keval
Date Posted: 28-May-2008 at 9:41pm
http://www.ideablade.com/forum/uploads/20080529_003532_ModelFiles.rar -
Hi
 
Followig is the link to the csdl and other files that u suggetsed
 
uploads/20080529_003532_ModelFiles.rar
 
As i found yesterday is that it worked for the insert and update and retreival for single record
 
but when i retreive it for multiple records, it gives me the error
 
There are no associations with the entity scheduledItem and nothing new than other entites as it is auto generated by Idablade model
 
Following is the stacktrace of error
 
 at IdeaBlade.EntityModel.v4.EntityManager.MergeAndReturnUsingCache(IEntityFinder finder, DataQueryResultCollection dqResults)
   at IdeaBlade.EntityModel.v4.EntityManager.ProcessFetchedData(DataQueryResultCollection dqResults, IEntityFinder finder)
   at IdeaBlade.EntityModel.v4.EntityManager.ExecuteFetch(IEntityFinder finder)
   at IdeaBlade.EntityModel.v4.EntityQueryFinder.Execute()
   at IdeaBlade.EntityModel.v4.EntityManager.ExecuteQueryCore(IEntityQuery query, QueryStrategy strategy)
   at IdeaBlade.EntityModel.v4.EntityManager.ExecuteQuery[T](IEntityQuery query, QueryStrategy strategy, Boolean checkT)
   at IdeaBlade.EntityModel.v4.EntityManager.ExecuteQuery[T](IEntityQuery`1 query)
   at IdeaBlade.EntityModel.v4.EntityQuery`1.GetEnumerator()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at HETransactions.QPaymentWizard.BuildCollection(String memberID) in D:\Projects\HealthEquity\VSS\IdeaBLade Project Code\HealthEquity.root\HealthEquity\HETransactions\QPaymentWizard.cs:line 53
 
And InnerException is
Object reference not set to an instance of an object.
 
Thanks.


Posted By: kimj
Date Posted: 29-May-2008 at 9:09am
Thanks for the files. 
 
I ran some simple tests with dummy data and couldn't reproduce the problem, so I think it might be data-related.  When you see the failure retrieving multiple records, how large is the ParametersXml field data?  Also, are you running with a BOS?
 
As I mentioned before, we did have several NullReferenceException problems with queries in Beta1 that should now be fixed in our soon-to-be-released Beta2 drop, so you might want to wait for Beta2 to see if this problem has been fixed.  If you don't want to wait (please don't ask for how long Smile), if it's not too much trouble you can send us both your database and a solution showing the failure.    (Send to mailto:support@ideablade.com - support@ideablade.com , attention Kim).


Posted By: keval
Date Posted: 02-Jun-2008 at 4:19am
Hi Kim,
 
I can not give u the database and solution because its a secure thing and contract with the client(you can understand)
 
But yes i think it might be a problem with data and same thing is happened with another entity.(Same error)
In both the cases, common thing is XML data. both table includes xml data.
 
In my case, xml is not too large. Following is the sample xml that is stored in DB for each record and there are 13 records satisfy the condition.
 
"<?xml version="1.0" encoding="utf-16"?><ClaimPaymentParameterList xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance - http://www.w3.org/2001/XMLSchema-instance " xmlns:xsd=" - 7.22truetruefalsefalse0http://www.w3.org/2001/XMLSchema"><Amount>7.22</Amount><PayMember>true</PayMember><PayAch>true</PayAch><AllowPartialPayment>false</AllowPartialPayment><AllowCreditPayment>false</AllowCreditPayment><CheckFee>0</CheckFee></ClaimPaymentParameterList >"
 
Can u please suggest me what can be the solution?
Thanks in advance.


Posted By: kimj
Date Posted: 02-Jun-2008 at 12:00pm
Hi Keval,
 
I've tried reproducing the problem with the ParametersXml data you posted, yet don't get an error.  I also tried changing the column data type from nvarchar(max) to xml to text - all without success in reproducing the problem.  What version of SQL Server are you using?
 
I'm stuck right now in diagnosing this.  Since the exception is occurring when retrieved data is merged into cache, you can try changing the QueryStrategy to see if that gets around the problem.  Try a QueryStrategy of DataSourceOnly to see what happens.


Posted By: keval
Date Posted: 02-Jun-2008 at 10:06pm
Hi Kim,
 
Thanks for your soluable reply.
 
It worked when i set QueryStrategy to DataSourceOnly
 
As for your knowledge, i m using SQL Server 2005 as a datasource.
 
Thanks again.


Posted By: kimj
Date Posted: 03-Jun-2008 at 8:39am
Keval, I'm glad the workaround works.  I'm sorry though that I wasn't able to reproduce the problem, so don't know if we've fixed it in current bits.   Thanks for your patience.



Print Page | Close Window