Hi Paul,

You are right. If your models are in different Cayenne projects, they are only 
combined in runtime, and there's no easy way of creating relationships between 
them. And looks like you've already found the workarounds.

I've had a case like yours, where I ended up creating those relationships 
dynamically in the code using "generic" properties. Technically it works, but 
takes away from the dev experience. So I'd go with one of the alternatives that 
you mentioned if possible.

In the future I'd like to see such a feature in Cayenne. When we looked at it 
previously, we ran into a design problem - how can CayenneModeler discover 
those upstream models are in a portable way. I.e. it should would work with 
version control, should resolve the same way on any developer machine, and be 
agnostic of the IDE and build tools. Be happy to brainstorm this further.

Thanks,
Andrus


> On Jan 20, 2023, at 4:26 PM, Paul L. Merchant Jr. 
> <paul.l.merchant...@dartmouth.edu> wrote:
> 
> Hi again,
> 
> I have another question coming from EnterpriseObjects land:  I have a 
> situation where two different applications each have their own application 
> specific set of tables in their own schemas and share a third set of tables 
> in another schema.  Each application has tables with relationships to the 
> shared tables, but the applications are not related to each other.
> 
> In EnterpriseObjects it's possible to create separate models of the shared 
> tables and each application's private tables so that one copy of the model of 
> the shared tables can be shared between the applications.
> 
> Can something similar be done in Cayenne?  It appears that multiple projects 
> can be imported into a runtime easily enough, but I'm missing how I can 
> create relationships between objects in two different projects.  The 
> alternatives I see are to either duplication the model of the shared tables 
> in each application's project or including all the models in one project, 
> both of which are less than ideal.  Maybe I've missed something?
> 
> Thanks!
> 
> -- Paul

Reply via email to