Cross data map relationships

Ricardo Parada <[email protected]> Tue, 14 Oct 2025 15:29:48 -0400
Newsgroups gmane.comp.java.cayenne.user
Message-ID <[email protected]>
Hello,

I wrote a converter to convert our eomodels from EOF to Cayenne-project.xml a=
nd data maps .map.xml

So far so good. However, I seem to be running into a problem for cross data m=
ap relationships.=20

I=E2=80=99m using 5.0-M1.=20

When I=E2=80=99m creating the ObjRelationship I call:

objRel.setTargetEntityName(targetObjEntity);

If I then call objRel.getTargetEntityName() it returns the correct target en=
tity name. =20

However, if I call objRel.getTargetEntity() it returns null.=20

I debugged the code and I can see that getTargetEntity() is looking for the t=
arget entity name in the data map corresponding to the source ObjEntity. And=
 it does not find it and returns null for that reason.=20

As a result of that, when I call encodeAsXML() on objRel I see that the XML i=
s missing the target attribute in the obj-relationship xml tag.=20

Is this a bug in 5.0-M1 or am I missing something when creating my ObjRelati=
onship programmatically.=20

I could put all eomodels that have cross eomodel relationships into the same=
 data map to avoid this problem.=20

But when I create it in Cayenne Modeler 4.3.3 it seems to work. I see the ob=
j-relationship in the XML have target correctly set.=20

Thank you all in advance.=20
Ricardo Parada=20