I create a query with custom criteria I want a list of objects back:
CustomCriterionList := TList<TCustomCriterion>.Create;
SQLStr := TObjectQuery.GetObjectQueryProperties(CustomCriterionList, '', Kunde, dsKunde);
for i := 0 to CustomCriterionList.Count - 1 do
Filter := CustomCriterionList.Items;
if CustomCriterionList.Count>0 then
ResultKdList := Criteria.List;
The result are always outdated data from cache, the data where changed meanwhile in the database by another app.
I read about the Refesh function, but this seems to be intended for single objects not for lists, right?
How to make sure a list of objects are loaded always from database and not from object cache?
You should create a separate manager for that, or clear the manager to destroy all objects. You can also also refresh each object in the list. But anyway that's expected behavior.
thanks for your quick reply.
I thought about that way before too, to always create a new Manager.
But I refrained from that because I think the whole db structure will be checked then always if I would do that, right?
Do there is a command to drop all objects from cache without checking the whole tables etc.?
Create the object manager is very lightweight and you should usually create/destory manager frequently for small operations. There is no problem in creating many of them. Tables are not checked at all, db structure is only checked if you use TDatabaseManager and explicitly ask it to check for structure (ValidateDatabase or UpdateDatabase).
Good to know.
I will rethink my strategy to create managers.
Now I refresh each object of query results, that works for me meanwhile.
That also works but it's much slower