EntityClass.java 文件源码

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

项目:org.fastnate 作者:
/**
 * Determine the inheritance type and discriminator properties.
 */
private void buildInheritance() {
    // Check, if we've got an explicit inheritance type
    final Inheritance inheritance = this.entityClass.getAnnotation(Inheritance.class);
    if (inheritance != null) {
        this.inheritanceType = inheritance.strategy();
    }

    // Find the root of our hierarchy
    this.hierarchyRoot = this;
    findHierarchyRoot(this.entityClass.getSuperclass());

    // We scan only classes that we are about to write
    // So we don't know, that there is a subclass entity - until we find one
    // This could be to late for InheritanceType.SINGLE_TABLE - the defaault type
    // That's why we build a discriminator, if one of the inheritance annotations exists
    if (this.inheritanceType == null && this.entityClass.isAnnotationPresent(DiscriminatorColumn.class)
            || this.entityClass.isAnnotationPresent(DiscriminatorValue.class)) {
        this.inheritanceType = InheritanceType.SINGLE_TABLE;
    }

    buildDiscriminator();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号