Dominique
Dominique

Reputation: 17565

Why do I get an Exception while trying to access some objects, based on Telerik OpenAccess library?

I'm working on a C# application, based on an SQL-Server database, read with Telerik OpenAccess libraries.

I try to read the following:

to.VehicleOrders

This fails with following Exception message:

Telerik.OpenAccess.Exceptions.DataStoreException
HResult=0x80131500
Message=Row for OID GenericOID@6426929c VehicleOrder Id=181049 NOTRES  is not in the hierarchy starting at <product>.Server.Core.Domain.VehicleOrder ('VehicleOrders') (voa_class for row is <product>.<Customer>.Server.Domain.<Customer>Order)
Source=Telerik.OpenAccess.Runtime
StackTrace:
at OpenAccessRuntime.ExceptionWrapper.Throw()
at OpenAccessRuntime.DataObjects.PCStateMan.handleException(Exception x)
at OpenAccessRuntime.DataObjects.PCStateMan.getObjectFieldImp(PersistenceCapable pc, FieldMetaData fmd, Object currentValue)
at OpenAccessRuntime.DataObjects.PCStateMan.GetObjectField(PersistenceCapable pc, Int32 field, Object currentValue)
at <product>.Server.Core.Domain.TransportOrder.OpenAccessEnhancedGet_vehicleOrders(TransportOrder owner)
at <product>.Server.Core.Domain.TransportOrder.get_VehicleOrders()
at <product>.Template.Server.Tasks.CleanUp_DB.Execute(String[] parameters) in C:\...\Projecten\...\<product>.<project>.Server\Tasks\CleanUp.cs:line 469

This exception was originally thrown at this call stack:
OpenAccessRuntime.ExceptionWrapper.Throw()
OpenAccessRuntime.DataObjects.PCStateMan.handleException(System.Exception)

OpenAccessRuntime.DataObjects.PCStateMan.getObjectFieldImp (Telerik.OpenAccess.SPI.dataobjects.PersistenceCapable, OpenAccessRuntime.metadata.FieldMetaData, object)
OpenAccessRuntime.DataObjects.PCStateMan.GetObjectField(Telerik.OpenAccess.SPI.dataobjects.PersistenceCapable, int, object)
<product>.Server.Core.Domain.TransportOrder.OpenAccessEnhancedGet_vehicleOrders(<product>.Server.Core.Domain.TransportOrder)
<product>.Server.Core.Domain.TransportOrder.VehicleOrders.get()
<product>.Template.Server.Tasks.CleanUp_DB.Execute(string[]) in CleanUp.cs

I have verified the voa_class in database, it is equal to <product>.<Customer>.Server.Domain.<Customer>Order, and is indeed derived from <product>.Server.Core.Domain.VehicleOrder (in another part of the code, there is the following definition: public class <Customer>Order : VehicleOrder, this in namespace <product>.<Customer>.Server.Domain).

In my opinion, this means that something is wrong, either in the voa_class column in the database, either in the inheritance tree, but both look ok.

Does anybody have an idea?

Upvotes: 0

Views: 46

Answers (1)

Dominique
Dominique

Reputation: 17565

In the meantime I've found the answer: my DB is corrupt!

In the table of VehicleOrders, I find a result for the mentioned Id:

SELECT *
  FROM VehicleOrders
  WHERE Id=181049

=> I have a result (and the column voa_class refers to <Customer>Order).

SELECT *
  FROM <Customer>Order
  WHERE Id=181049

=> I have no result.

As the root cause of this problem is a corrupted database, no further actions are to be taken at source code side, hence my question can be declared "answered".

Upvotes: 0

Related Questions