Hi Marcin,
Probably a bug in faulting... The analysis below is from memory. I
haven't checked the code to confirm it :-). Cayenne always assumes
that if a given object contains an FK to a target object (non-
flattened to-one), that a target object exists. This can potentially
save a trip to the DB (e.g. if all you want to do is to check whether
target is null or not). This is based on the assumption of referential
integrity, which by itself may be overly optimistic, and you just
poked another hole in it - if a target entity has a qualifier, non-
null FK in the source does not mean much.
So I'd say open a Jira improvement request and we'll add an extra
condition check for super-lazy faulting of to-ones.
Andrus
On Nov 26, 2007, at 2:45 AM, Marcin Skladaniec wrote:
> Hi
>
> I have problems with entity qualifier and relationships. I defined
> "isDeleted" column in few tables, and when the record is deleted is
> not really removed from the database. In cayenne modeller I
> specified a entity qualifier to not include those deleted objects in
> any query, but I found that it does not always work:
>
> For one to many relation:
> - entity qualifier works well when going "to many"
> - entity qualifier does not work when going "to one"
> For one to one relations it does not work at all.
>
> I know that I could simply delete the relationship, but the goal is
> to avoid orphaned objects, and keep the history.
>
> Is it a bug in cayenne, or a desired behaviour ?
>
> With regards
> Marcin
This archive was generated by hypermail 2.0.0 : Mon Nov 26 2007 - 16:14:45 EST