void appendQueriesInternal(Collection queries) {
DataDomainDBDiffBuilder diffBuilder = new DataDomainDBDiffBuilder();
EntitySorter sorter = parent.getDomain().getEntitySorter();
sorter.sortDbEntities(dbEntities, false);
Iterator i = dbEntities.iterator();
while (i.hasNext()) {
DbEntity dbEntity = (DbEntity) i.next();
List objEntitiesForDbEntity = (List) descriptorsByDbEntity.get(dbEntity);
InsertBatchQuery batch = new InsertBatchQuery(dbEntity, 27);
Iterator j = objEntitiesForDbEntity.iterator();
while (j.hasNext()) {
ClassDescriptor descriptor = (ClassDescriptor) j.next();
diffBuilder.reset(descriptor.getEntity(), dbEntity);
boolean isMasterDbEntity = (descriptor.getEntity().getDbEntity() == dbEntity);
// remove object set for dependent entity, so that it does not show up
// on post processing
List objects = (List) (isMasterDbEntity ? objectsByDescriptor
.get(descriptor) : objectsByDescriptor.remove(descriptor));
if (objects.isEmpty()) {
continue;
}
checkReadOnly(descriptor.getEntity());
if (isMasterDbEntity) {
createPermIdsForObjEntity(descriptor, objects);
sorter.sortObjectsForEntity(descriptor.getEntity(), objects, false);
}
for (Iterator k = objects.iterator(); k.hasNext();) {
Persistent o = (Persistent) k.next();