@Override
public void onFinishNode(ProjectPath path) {
JpaEntity entity = path.firstInstanceOf(JpaEntity.class);
DataMap dataMap = targetPath.firstInstanceOf(DataMap.class);
ObjEntity cayenneEntity = targetPath.firstInstanceOf(ObjEntity.class);
// as superentity may not be loaded yet, must lookup DbEntity via JPA
// mapping...
DbEntity cayennePrimaryTable = dataMap.getDbEntity(entity
.lookupTable()
.getName());
for (JpaSecondaryTable secondaryTable : entity.getSecondaryTables()) {
// create a relationship between master DbEntity and a secondary
// DbEntity...
DbEntity cayenneSecondaryTable = dataMap.getDbEntity(secondaryTable
.getName());
JpaDbRelationship dbRelationship = new JpaDbRelationship(
getSecondaryTableDbRelationshipName(secondaryTable.getName()));
dbRelationship.setTargetEntityName(secondaryTable.getName());