Thank you for the answer. As I understand I follow Composition Design, but still have problems with implementing inheritance...
It seems my first message was badly formatted. So I'll copy it in this message again: ----------------- Hello! I am trying to model a list of heterogeneous entities by having a ListItem table where the list item entity is able to point to an arbitrary entity (Person, Computer, URL, Movie, etc). I don't want to use single-table inheritance natively supported by Cayenne because of big database size overheads (the entities are drastically different from one another). In fact I don't necessarily want to use inheritance at all (PersonListItem, ComputerListItem, etc), but this seems to be the only option in Cayenne to model such a list. I've read Mike Kienenberger's article (http://cwiki.apache.org/CAY/compositeverticalinheritance.html) about simulation of vertical inheritance in Cayenne and found that it might be acceptable for my case. But I am having problems generating classes from the velocity template given in the article, although I've used code generator parameters recommended in article. It seems the parser fails to parse ${objEntity.getClientSuperClassName()}, ${anObjEntity.getClientClassName()}, although other methods/attributes of "objEntity", "entityUtils", "stringUtils", "importUtils" are parsed correctly. I've tried with Cayenne 2.0.4, Cayenne 3.0M4. Thank you, Andrey Strib.