Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
3.1M1
-
None
Description
This is something that came up in my work, and the feature is about allowing Cayenne to handle some really loose schemas. Consider 2 tables:
t1 ( pk1, pk2, c1)
t2 ( pk, fk_c1, fk_pk2)
t1 has PK defined as (pk1,pk2), at the same time (pk2, c1) also uniquely identifies each row. A relationship t2 join t1 on (t2.fk_c1 = t1.c1 and t2.fk_pk2 = t1.pk2) doesn't work. When 1..N part is resolved, a query like this is generated:
SELECT t2.* FROM t2 WHERE t2.fk_c1 = NULL AND t2.fk_pk2 = ? [bind: 1->fk_pk2:'correct_value']
This is not super high priority, but I think we should support such fuzzy relationships. Cayenne traditionally had strong support for various legacy schemas. So we should support this case as well.