I'm using Cayenne 4.1 and want to use the single table inheritance, but I have the problem that when using the modeller the DB relation I've created in the modeller are always dropped :-/ In Detail: I have the table and entity photo (superclass), the I have subclasses photoA and photoB, in photo I have a field (qualifier) which has the id of class A or class B, as it's not possible to maintain such an ambivalent relation directly in the DB, I maintain the relation in the modeller, so I can use it in the entity class, this works all fine, except that when I run the reengineer database schema function that the relations are dropped :-/
...but maybe I understood the concept wrong :-(
br Markus
You got everything right, you just hit the limitation of the Cayenne DB import functionality. It allows you to customize only the object layer, not DB, as it doesn't keep track of changes and just compares your model with the DB state on every run.
Here what you could do about it:
Don't use DB import for the part you need to customize. This means you need to maintain your model manually. This could be hard, as you need also to exclude all connected parts of your model (and that could be all your model). Not so great option.
Or, a better option. You could try to switch from the Modeler DB import to the Cayenne Maven (or Gradle) plugin. It supports the exclusion of relationships by name, it not as easy to set up as a Modeler, but functionally it's on par. Here are some links to the related documentation: Maven plugin tutorial, relationship exclusion.