@Override
void appendQueriesInternal(Collection<Query> queries) {
DataDomainDBDiffBuilder diffBuilder = new DataDomainDBDiffBuilder();
EntitySorter sorter = parent.getDomain().getEntitySorter();
sorter.sortDbEntities(dbEntities, false);
for (DbEntity dbEntity : dbEntities) {
Collection<DbEntityClassDescriptor> descriptors = descriptorsByDbEntity
.get(dbEntity);
InsertBatchQuery batch =
new DataDomainInsertQuery(parent.getDomain(), dbEntity, 27);
for (DbEntityClassDescriptor descriptor : descriptors) {
diffBuilder.reset(descriptor);
List<Persistent> objects = objectsByDescriptor.get(descriptor
.getClassDescriptor());
if (objects.isEmpty()) {
continue;
}
checkReadOnly(descriptor.getEntity());
createPermIds(descriptor, objects);
sorter.sortObjectsForEntity(descriptor.getEntity(), objects, false);
for (Persistent o : objects) {
Map<Object, Object> snapshot = diffBuilder.buildDBDiff(parent
.objectDiff(o.getObjectId()));