Index: mapper.py
===================================================================
--- mapper.py	(revision 2088)
+++ mapper.py	(working copy)
@@ -220,13 +220,15 @@
     def _is_orphan(self, obj):
         optimistic = has_identity(obj)
         for (key,klass) in self.delete_orphans:
-            if not getattr(klass, key).hasparent(obj, optimistic=optimistic):
-                if not has_identity(obj):
-                    raise exceptions.FlushError("instance %s is an unsaved, pending instance and is an orphan (is not attached to any parent '%s' instance via that classes' '%s' attribute)" % (obj, klass.__name__, key))
-                return True
+            if getattr(klass, key).hasparent(obj, optimistic=optimistic):
+                return False
         else:
             return False
             
+        if not has_identity(obj):
+            raise exceptions.FlushError("instance %s is an unsaved, pending instance and is an orphan (is not attached to any parent '%s' instance via that classes' '%s' attribute)" % (obj, klass.__name__, key))
+        return True
+            
     def _get_props(self):
         self.compile()
         return self.__props