- I am getting "SD.LLBLGen.Pro.ORMSupportClasses.ORMEntityOutOfSyncException} occurred", when I am trying to fetch the persisted information multiple times.
- I am getting "During a recursive save action an entity's save action failed. The entity which failed is enclosed." when I am trying to update the retrieved entity.
I have a JobQueueEntity and it has related entities JobAffectedEntity (similar to Customer and Orders for the customer).
JobQueueEntity maintains a Guid, 3 ints and a byte array (image type);
I am able to persist the job information successfully using:
using(DataAccessAdapter dataAccessAdapter = new DataAccessAdapter(ConfigurationSettings.AppSettings["connString"],true))
{
// Get the affected entities from the Job
ArrayList affectedEntities = job.GetAffectedEntities();
JobQueueEntity jobQueueEntity = new JobQueueEntity();
jobQueueEntity.JobId = job.JobID;
jobQueueEntity.JobStatusNumber = (byte)job.State;
jobQueueEntity.JobTypeNumber = 0;
jobQueueEntity.OperationModeNumber = 0;
jobQueueEntity.JobObject = SerializeJob(job);
// Add the job to the database
bool saveResult = dataAccessAdapter.SaveEntity(jobQueueEntity, true);
EntityCollection jobAffectedEntityCollection = new EntityCollection();
foreach(AffectedEntity affectedEntity in affectedEntities)
{
if ((affectedEntity.AffectedEntityType == AffectedEntityType.Statement) || (affectedEntity.AffectedEntityType == AffectedEntityType.Page))
{
// TODO: Add entities to collections
JobAffectedEntityEntity item = new JobAffectedEntityEntity();
item.JobId = job.JobID;
item.DataOperationNumber = (byte)job.JobOperation;
switch(affectedEntity.AffectedEntityType)
{
case AffectedEntityType.Statement: item.StatementId = (affectedEntity as AffectedStatement).StatementId;
break;
case AffectedEntityType.Page item.StatementId = (affectedEntity as AffectedPage).StatementId; item.PageId = (affectedEntity as AffectedPage).PageId;
break;
}
}
}
int retCode = dataAccessAdapter.SaveEntityCollection(jobAffectedEntityCollection);
}
After saving the JobQueueEntity, I am trying to read the persisted information using the following:
JobQueueEntity jobQueueEntity;
// Create the data acess adapter object.
using(DataAccessAdapter dataAccessAdapter = new DataAccessAdapter(ConfigurationSettings.AppSettings["connString"],true))
{
jobQueueEntity = new JobQueueEntity(jobId);
bool retcode = dataAccessAdapter.FetchEntity(jobQueueEntity);
}
I am able to read the persisted JobQueueEntity once and I am getting the following error for subsequent fetches:
<error: an exception of type: {SD.LLBLGen.Pro.ORMSupportClasses.ORMEntityOutOfSyncException} occurred>
Before trying to read second time, JobQueueEntity information is present in the database and after getting the above error, I don't see the JobQueueEntity information in the database and the returned code is false.
- When I am trying to update the JobQueueEntiy after fetching the JobQueueEntity first time and I am getting the following error:
{"During a recursive save action an entity's save action failed. The entity which failed is enclosed." }
JobQueueEntity jobQueueEntity;
using(DataAccessAdapter dataAccessAdapter = new DataAccessAdapter(ConfigurationSettings.AppSettings["connString"],true))
{
// Read the Job's existing record
jobQueueEntity = new JobQueueEntity(job.JobID);
bool retcode = dataAccessAdapter.FetchEntity(jobQueueEntity);
if (jobQueueEntity != null)
{
// TODO: Update field values
jobQueueEntity.JobStatusNumber = (byte)job.State;
// Serialize the job
jobQueueEntity.JobObject = SerializeJob(job);
// Save the updated job record
dataAccessAdapter.SaveEntity(jobQueueEntity);
}
}
I could not update the persisted information and I could not fetch the persisted information more than once.
I am using SD.LLBLGen.Pro.ORMSupportClasses.NET11.dll. version 1.0.2004.2 August 5, 2004
Could you tell me whether I am missing anything?