EntityConfigFactory.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:celerio 作者:
private void resolveMissingInheritanceStrategyOnEntityConfigs(Map<String, EntityConfig> entityConfigsByEntityName) {
    for (EntityConfig entityConfig : entityConfigsByEntityName.values()) {
        if (!entityConfig.hasInheritance()) {
            continue;
        }

        EntityConfig current = entityConfig;
        while (current.hasParentEntityName()) {
            current = entityConfigsByEntityName.get(current.getParentEntityName().toUpperCase());
            Assert.notNull(current, "The parent entity " + current.getParentEntityName() + " could not be found in the configuration.");
        }
        // root may use default...
        if (!current.getInheritance().hasStrategy()) {
            // default...
            current.getInheritance().setStrategy(InheritanceType.SINGLE_TABLE);
        }

        if (entityConfig.getInheritance().hasStrategy()) {
            Assert.isTrue(
                    entityConfig.getInheritance().getStrategy() == current.getInheritance().getStrategy(),
                    "The entityConfig " + entityConfig.getEntityName()
                            + " must not declare an inheritance strategy that is different from the strategy declared in the root entity "
                            + current.getEntityName());
        }

        // for internal convenient purposes we propagate it
        entityConfig.getInheritance().setStrategy(current.getInheritance().getStrategy());
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号