public void flush() {
DatastoreSession<?, Entity, ? extends DatastoreEntityMetadata<?>, ?, ?, Relation, ? extends DatastoreRelationMetadata<?>, ?> datastoreSession = sessionContext.getDatastoreSession();
InstanceListenerService instanceListenerService = sessionContext.getInstanceListenerService();
for (Object instance : sessionContext.getRelationCache().writtenInstances()) {
Relation relation = sessionContext.getRelationInstanceManager().getDatastoreType(instance);
instanceListenerService.preUpdate(instance);
validateInstance(instance);
datastoreSession.flushRelation(relation);
instanceListenerService.postUpdate(instance);
}
for (Object instance : sessionContext.getEntityCache().writtenInstances()) {