类org.hibernate.persister.entity.UnionSubclassEntityPersister源码实例Demo

下面列出了怎么用org.hibernate.persister.entity.UnionSubclassEntityPersister的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: 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);
	}
}
 
源代码2 项目: gorm-hibernate5   文件: GrailsDomainBinder.java
public void bindUnionSubclass(HibernatePersistentEntity subClass, UnionSubclass unionSubclass,
                              InFlightMetadataCollector mappings, String sessionFactoryBeanName) throws MappingException {
    bindClass(subClass, unionSubclass, mappings);

    Mapping subMapping = getMapping(subClass.getJavaClass());

    if ( unionSubclass.getEntityPersisterClass() == null ) {
        unionSubclass.getRootClass().setEntityPersisterClass(
                UnionSubclassEntityPersister.class );
    }

    String schema = subMapping != null && subMapping.getTable().getSchema() != null ?
            subMapping.getTable().getSchema() : null;

    String catalog = subMapping != null && subMapping.getTable().getCatalog() != null ?
            subMapping.getTable().getCatalog() : null;

    Table denormalizedSuperTable = unionSubclass.getSuperclass().getTable();
    Table mytable = mappings.addDenormalizedTable(
            schema,
            catalog,
            getTableName(subClass, sessionFactoryBeanName),
            unionSubclass.isAbstract() != null && unionSubclass.isAbstract(),
            null,
            denormalizedSuperTable
    );
    unionSubclass.setTable( mytable );
    unionSubclass.setClassName(subClass.getName());

    LOG.info(
            "Mapping union-subclass: " + unionSubclass.getEntityName() +
                    " -> " + unionSubclass.getTable().getName()
    );

    createClassProperties(subClass, unionSubclass, mappings, sessionFactoryBeanName);

}
 
源代码3 项目: cacheonix-core   文件: HbmBinder.java
public static void bindUnionSubclass(Element node, UnionSubclass unionSubclass,
		Mappings mappings, java.util.Map inheritedMetas) throws MappingException {

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

	if ( unionSubclass.getEntityPersisterClass() == null ) {
		unionSubclass.getRootClass().setEntityPersisterClass(
			UnionSubclassEntityPersister.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 denormalizedSuperTable = unionSubclass.getSuperclass().getTable();
	Table mytable = mappings.addDenormalizedTable(
			schema,
			catalog,
			getClassTableName(unionSubclass, node, schema, catalog, denormalizedSuperTable, mappings ),
	        unionSubclass.isAbstract() != null && unionSubclass.isAbstract().booleanValue(),
			getSubselect( node ),
			denormalizedSuperTable
		);
	unionSubclass.setTable( mytable );

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

	createClassProperties( node, unionSubclass, mappings, inheritedMetas );

}
 
源代码4 项目: lams   文件: StandardPersisterClassResolver.java
public Class<? extends EntityPersister> unionSubclassEntityPersister() {
	return UnionSubclassEntityPersister.class;
}
 
源代码5 项目: lams   文件: AssignmentSpecification.java
public AssignmentSpecification(AST eq, Queryable persister) {
	if ( eq.getType() != HqlSqlTokenTypes.EQ ) {
		throw new QueryException( "assignment in set-clause not associated with equals" );
	}

	this.eq = eq;
	this.factory = persister.getFactory();

	// Needed to bump this up to DotNode, because that is the only thing which currently
	// knows about the property-ref path in the correct format; it is either this, or
	// recurse over the DotNodes constructing the property path just like DotNode does
	// internally
	final DotNode lhs = (DotNode) eq.getFirstChild();
	final SqlNode rhs = (SqlNode) lhs.getNextSibling();

	validateLhs( lhs );

	final String propertyPath = lhs.getPropertyPath();
	Set<String> temp = new HashSet<String>();
	// yuck!
	if ( persister instanceof UnionSubclassEntityPersister ) {
		final String[] tables = persister.getConstraintOrderedTableNameClosure();
		Collections.addAll( temp, tables );
	}
	else {
		temp.add(
				persister.getSubclassTableName( persister.getSubclassPropertyTableNumber( propertyPath ) )
		);
	}
	this.tableNames = Collections.unmodifiableSet( temp );

	if ( rhs == null ) {
		hqlParameters = new ParameterSpecification[0];
	}
	else if ( isParam( rhs ) ) {
		hqlParameters = new ParameterSpecification[] {( (ParameterNode) rhs ).getHqlParameterSpecification()};
	}
	else {
		List parameterList = ASTUtil.collectChildren(
				rhs,
				new ASTUtil.IncludePredicate() {
					public boolean include(AST node) {
						return isParam( node );
					}
				}
		);
		hqlParameters = new ParameterSpecification[parameterList.size()];
		Iterator itr = parameterList.iterator();
		int i = 0;
		while ( itr.hasNext() ) {
			hqlParameters[i++] = ( (ParameterNode) itr.next() ).getHqlParameterSpecification();
		}
	}
}
 
 类所在包
 类方法
 同包方法