Hi, We've discussed this time ago, but I'm back now with some ideas.
Current situation: I have to use special boolean column named "deleted" in all DB tables. That is, I never (or very rarely) do something like "DELETE FROM ..." or "context.deleteObject()", instead I do "UPDATE... SET deleted=true" or cdo.setDeleted(true). To select only undeleted records, I add qualifier like "deleted=true" to every ObjEntity. Also I add pre-update listeners to all entities which unregisters object and processes delete rules (also respective to 'deleted' field) if 'deleted' flag is set. It is obvious that Cayenne cannot completely handle this situation. One example is CAY-1109, but it can be workarounded as described above. More serious problems are: - I cannot use properly flattened relationships, because 'deleted' qualifier is not applied to DBEntities selection (e.g. in 'medium' table of many-to-many relationship) - flattened expressions, e.g. toArtist.name="Rublev" also miss that qualifier - there is no objects with DELETED state, only with MODIFIED ...and so on. I faced this situation since the first days I used Cayenne. Now when I thought about this a bit, I think I can handle it with two new features. I'm not sure they completely match Cayenne paradigm, but... 1. DBEntity qualifier. This is same as ObjEntity qualifier, but applied every time DBentity is being added to select sql. I will add DBEntity qualifier 'deleted=false' and drop current ObjEntity's 2. Deletion strategy for DataDomain. This means I do not always fire DeleteAction, but maybe something else (update action in my case). Any comments much appreciated. Thanks, Andrey
