Generated classes

A solution

New options in .doml file are massUpdates and massDeletes. They're implemented as boolean attributes of doml and table tags. Default values are false.

When turned on new options allow you to build data layer including two classes xxxUpdate and xxxDelete. These classes provide you QueryBuilder speed in massive update operations, while maintaining caches (both global and transactions) valid.

Classes xxxUpdate and xxxDelete have constructor that takes xxxQuery as parameter. This instance of query builds WHERE clause of a statement, while setCOLUMN methods provide contents of SET part.

    xxxQuery  query = new xxxQuery(dbt);
    query.setQueryCOLUMN_NAME(value);
    xxxUpdate update = new xxxUpdate(query);
    update.setANOTHER_COLUMN(another_column_value);
    update.save();
    dbt.commit();
  

In order to keep caches valid, global query caches (for affected table) are cleared, because we cannot compute their consistency without all DataStructs. DataStructs in global cache and DO objects in transaction caches are removed (for delete) or emptied (they will be loaded as with lazy load feature, for update). When using true (default value) for IncrementVersions entries in cache are removed also. Only SelectOIds parameter gives the cache enough information (list of OIds) to precisely update its contents.

New .conf parameter SelectOids introduced at DatabaseManager, LogicalDatabase, and table level, specifies whether there would be additional select statement executed to collect oids that would be affected by mass modification. Default value for SelectOids is false, and usual override method is applied too (table level overrides database which in turn overrides manager's value). If parameter is true, before actually executing massive modifications select statement will be run to collect list of OId's. This is then used to update cache for listed DataStructs/DOs only. Otherwise (SelectOids is false), all instances of xxxDataStruct/xxxDO will be updated.

Both xxxUpdate and xxxDelete have method setSelectOIds(boolean) for developer to prevent configuration parameter SelectOids effects. If certain mass modification will affect many rows, developer may choose to prevent collecting oids, so even if administrator sets parameter to true, application doesn't lose on its speed.

    xxxQuery  query = new xxxQuery(dbt);
    query.setQueryCOLUMN_NAME(value);
    xxxDelete delete = new xxxDelete(query);
    delete.setSelectOIds(false);
    delete.save();
    dbt.commit();