class JpaTableVisitor extends NestedVisitor {
@Override
Object createObject(ProjectPath path) {
JpaTable jpaTable = (JpaTable) path.getObject();
ObjEntity parentCayenneEntity = (ObjEntity) targetPath.getObject();
DbEntity cayenneEntity = parentCayenneEntity.getDataMap().getDbEntity(
jpaTable.getName());
if (cayenneEntity == null) {
cayenneEntity = new DbEntity(jpaTable.getName());
parentCayenneEntity.getDataMap().addDbEntity(cayenneEntity);
}
// override catalog and schema even if this is an existing entity. See for
// instance JpaColumnVisitor for an example on how an entity without all
// properties is created early.
cayenneEntity.setCatalog(jpaTable.getCatalog());
cayenneEntity.setSchema(jpaTable.getSchema());
parentCayenneEntity.setDbEntity(cayenneEntity);
return cayenneEntity;
}