Java 类org.hibernate.persister.entity.JoinedSubclassEntityPersister 实例源码

项目:cacheonix-core    文件:PersisterFactory.java   
public static EntityPersister createClassPersister(
        PersistentClass model, 
        CacheConcurrencyStrategy cache, 
        SessionFactoryImplementor factory,
        Mapping cfg)
throws HibernateException {
    Class persisterClass = model.getEntityPersisterClass();
    if (persisterClass==null || persisterClass==SingleTableEntityPersister.class) {
        return new SingleTableEntityPersister(model, cache, factory, cfg);
    }
    else if (persisterClass==JoinedSubclassEntityPersister.class) {
        return new JoinedSubclassEntityPersister(model, cache, factory, cfg);
    }
    else if (persisterClass==UnionSubclassEntityPersister.class) {
        return new UnionSubclassEntityPersister(model, cache, factory, cfg);
    }
    else {
        return create(persisterClass, model, cache, factory, cfg);
    }
}
项目:lams    文件:StandardPersisterClassResolver.java   
public Class<? extends EntityPersister> joinedSubclassEntityPersister() {
    return JoinedSubclassEntityPersister.class;
}
项目:cacheonix-core    文件:HbmBinder.java   
public static void bindJoinedSubclass(Element node, JoinedSubclass joinedSubclass,
        Mappings mappings, java.util.Map inheritedMetas) throws MappingException {

    bindClass( node, joinedSubclass, mappings, inheritedMetas );
    inheritedMetas = getMetas( node, inheritedMetas, true ); // get meta's from
                                                                // <joined-subclass>

    // joined subclasses
    if ( joinedSubclass.getEntityPersisterClass() == null ) {
        joinedSubclass.getRootClass()
            .setEntityPersisterClass( JoinedSubclassEntityPersister.class );
    }

    Attribute schemaNode = node.attribute( "schema" );
    String schema = schemaNode == null ?
            mappings.getSchemaName() : schemaNode.getValue();

    Attribute catalogNode = node.attribute( "catalog" );
    String catalog = catalogNode == null ?
            mappings.getCatalogName() : catalogNode.getValue();

    Table mytable = mappings.addTable(
            schema,
            catalog,
            getClassTableName( joinedSubclass, node, schema, catalog, null, mappings ),
            getSubselect( node ),
            false
        );
    joinedSubclass.setTable( mytable );
    bindComment(mytable, node);

    log.info(
            "Mapping joined-subclass: " + joinedSubclass.getEntityName() +
            " -> " + joinedSubclass.getTable().getName()
        );

    // KEY
    Element keyNode = node.element( "key" );
    SimpleValue key = new DependantValue( mytable, joinedSubclass.getIdentifier() );
    joinedSubclass.setKey( key );
    key.setCascadeDeleteEnabled( "cascade".equals( keyNode.attributeValue( "on-delete" ) ) );
    bindSimpleValue( keyNode, key, false, joinedSubclass.getEntityName(), mappings );

    // model.getKey().setType( new Type( model.getIdentifier() ) );
    joinedSubclass.createPrimaryKey();
    joinedSubclass.createForeignKey();

    // CHECK
    Attribute chNode = node.attribute( "check" );
    if ( chNode != null ) mytable.addCheckConstraint( chNode.getValue() );

    // properties
    createClassProperties( node, joinedSubclass, mappings, inheritedMetas );

}