InheritanceState.java 文件源码

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

项目:lams 作者:
private void addMappedSuperClassInMetadata(PersistentClass persistentClass) {
    //add @MappedSuperclass in the metadata
    // classes from 0 to n-1 are @MappedSuperclass and should be linked
    org.hibernate.mapping.MappedSuperclass mappedSuperclass = null;
    final InheritanceState superEntityState =
            InheritanceState.getInheritanceStateOfSuperEntity( clazz, inheritanceStatePerClass );
    PersistentClass superEntity =
            superEntityState != null ?
                    mappings.getClass( superEntityState.getClazz().getName() ) :
                    null;
    final int lastMappedSuperclass = classesToProcessForMappedSuperclass.size() - 1;
    for ( int index = 0; index < lastMappedSuperclass; index++ ) {
        org.hibernate.mapping.MappedSuperclass parentSuperclass = mappedSuperclass;
        final Class<?> type = mappings.getReflectionManager()
                .toClass( classesToProcessForMappedSuperclass.get( index ) );
        //add MAppedSuperclass if not already there
        mappedSuperclass = mappings.getMappedSuperclass( type );
        if ( mappedSuperclass == null ) {
            mappedSuperclass = new org.hibernate.mapping.MappedSuperclass( parentSuperclass, superEntity );
            mappedSuperclass.setMappedClass( type );
            mappings.addMappedSuperclass( type, mappedSuperclass );
        }
    }
    if ( mappedSuperclass != null ) {
        persistentClass.setSuperMappedSuperclass( mappedSuperclass );
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号