当前位置: 首页>>代码示例>>Java>>正文


Java Collection.getRole方法代码示例

本文整理汇总了Java中org.hibernate.mapping.Collection.getRole方法的典型用法代码示例。如果您正苦于以下问题:Java Collection.getRole方法的具体用法?Java Collection.getRole怎么用?Java Collection.getRole使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hibernate.mapping.Collection的用法示例。


在下文中一共展示了Collection.getRole方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkFilterConditions

import org.hibernate.mapping.Collection; //导入方法依赖的package包/类
private static void checkFilterConditions(Collection collValue) {
	//for now it can't happen, but sometime soon...
	if ( ( collValue.getFilters().size() != 0 || StringHelper.isNotEmpty( collValue.getWhere() ) ) &&
			collValue.getFetchMode() == FetchMode.JOIN &&
			!( collValue.getElement() instanceof SimpleValue ) && //SimpleValue (CollectionOfElements) are always SELECT but it does not matter
			collValue.getElement().getFetchMode() != FetchMode.JOIN ) {
		throw new MappingException(
				"@ManyToMany or @CollectionOfElements defining filter or where without join fetching "
						+ "not valid within collection using join fetching[" + collValue.getRole() + "]"
		);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:CollectionBinder.java

示例2: bindIndex

import org.hibernate.mapping.Collection; //导入方法依赖的package包/类
private void bindIndex(final Mappings mappings) {
	if ( !indexColumn.isImplicit() ) {
		PropertyHolder valueHolder = PropertyHolderBuilder.buildPropertyHolder(
				this.collection,
				StringHelper.qualify( this.collection.getRole(), "key" ),
				null,
				null, propertyHolder, mappings
		);
		List list = (List) this.collection;
		if ( !list.isOneToMany() ) indexColumn.forceNotNull();
		indexColumn.setPropertyHolder( valueHolder );
		SimpleValueBinder value = new SimpleValueBinder();
		value.setColumns( new Ejb3Column[] { indexColumn } );
		value.setExplicitType( "integer" );
		value.setMappings( mappings );
		SimpleValue indexValue = value.make();
		indexColumn.linkWithValue( indexValue );
		list.setIndex( indexValue );
		list.setBaseIndex( indexColumn.getBase() );
		if ( list.isOneToMany() && !list.getKey().isNullable() && !list.isInverse() ) {
			String entityName = ( (OneToMany) list.getElement() ).getReferencedEntityName();
			PersistentClass referenced = mappings.getClass( entityName );
			IndexBackref ib = new IndexBackref();
			ib.setName( '_' + propertyName + "IndexBackref" );
			ib.setUpdateable( false );
			ib.setSelectable( false );
			ib.setCollectionRole( list.getRole() );
			ib.setEntityName( list.getOwner().getEntityName() );
			ib.setValue( list.getIndex() );
			referenced.addProperty( ib );
		}
	}
	else {
		Collection coll = this.collection;
		throw new AnnotationException(
				"List/array has to be annotated with an @OrderColumn (or @IndexColumn): "
						+ coll.getRole()
		);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:41,代码来源:ListBinder.java

示例3: finishUp

import org.hibernate.mapping.Collection; //导入方法依赖的package包/类
@Override
public void finishUp(PersisterCreationContext creationContext) {
	for ( EntityHierarchyNode root : roots ) {
		// todo : resolve any MappedSuperclasses for supers of the root entity
		EntityHierarchy entityHierarchy = new EntityHierarchyImpl(
				creationContext,
				(RootClass) root.mappingType,
				(EntityPersister) root.ormJpaType
		);

		finishSupers( root.superEntityNode, entityHierarchy, creationContext );

		root.finishUp( entityHierarchy, creationContext );

		entityHierarchy.finishInitialization( creationContext, (RootClass) root.mappingType );
	}

	// todo :
	for ( final Collection model : creationContext.getMetadata().getCollectionBindings() ) {
		final CollectionPersister collectionPersister = creationContext.getTypeConfiguration().findCollectionPersister( model.getRole() );
		if ( collectionPersister == null ) {
			throw new HibernateException( "Collection role not properly materialized to CollectionPersister : " + model.getRole() );
		}
		collectionPersister.finishInitialization( model, creationContext );
	}

	for ( EmbeddableMapper mapper : creationContext.getTypeConfiguration().getEmbeddablePersisters() ) {
		mapper.afterInitialization(
				embeddableComponentMap.get( mapper ),
				creationContext
		);
	}


	serviceRegistry = null;
	roots.clear();
	nameToHierarchyNodeMap.clear();
	embeddableComponentMap.clear();
}
 
开发者ID:hibernate,项目名称:hibernate-semantic-query,代码行数:40,代码来源:PersisterFactoryImpl.java

示例4: bindManyToManySubelements

import org.hibernate.mapping.Collection; //导入方法依赖的package包/类
private static void bindManyToManySubelements(
        Collection collection,
        Element manyToManyNode,
        Mappings model) throws MappingException {
	// Bind the where
	Attribute where = manyToManyNode.attribute( "where" );
	String whereCondition = where == null ? null : where.getValue();
	collection.setManyToManyWhere( whereCondition );

	// Bind the order-by
	Attribute order = manyToManyNode.attribute( "order-by" );
	String orderFragment = order == null ? null : order.getValue();
	collection.setManyToManyOrdering( orderFragment );

	// Bind the filters
	Iterator filters = manyToManyNode.elementIterator( "filter" );
	if ( ( filters.hasNext() || whereCondition != null ) &&
	        collection.getFetchMode() == FetchMode.JOIN &&
	        collection.getElement().getFetchMode() != FetchMode.JOIN ) {
		throw new MappingException(
		        "many-to-many defining filter or where without join fetching " +
		        "not valid within collection using join fetching [" + collection.getRole() + "]"
			);
	}
	final boolean debugEnabled = LOG.isDebugEnabled();
	while ( filters.hasNext() ) {
		final Element filterElement = ( Element ) filters.next();
		final String name = filterElement.attributeValue( "name" );
		String condition = filterElement.getTextTrim();
		if ( StringHelper.isEmpty(condition) ) condition = filterElement.attributeValue( "condition" );
		if ( StringHelper.isEmpty(condition) ) {
			condition = model.getFilterDefinition(name).getDefaultFilterCondition();
		}
		if ( condition==null) {
			throw new MappingException("no filter condition found for filter: " + name);
		}
		Iterator aliasesIterator = filterElement.elementIterator("aliases");
		java.util.Map<String, String> aliasTables = new HashMap<String, String>();
		while (aliasesIterator.hasNext()){
			Element alias = (Element) aliasesIterator.next();
			aliasTables.put(alias.attributeValue("alias"), alias.attributeValue("table"));
		}
		if ( debugEnabled ) {
			LOG.debugf( "Applying many-to-many filter [%s] as [%s] to role [%s]", name, condition, collection.getRole() );
		}
		String autoAliasInjectionText = filterElement.attributeValue("autoAliasInjection");
		boolean autoAliasInjection = StringHelper.isEmpty(autoAliasInjectionText) ? true : Boolean.parseBoolean(autoAliasInjectionText);
		collection.addManyToManyFilter(name, condition, autoAliasInjection, aliasTables, null);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:51,代码来源:HbmBinder.java

示例5: addCollection

import org.hibernate.mapping.Collection; //导入方法依赖的package包/类
public void addCollection(Collection collection) throws DuplicateMappingException {
	Object old = collections.put( collection.getRole(), collection );
	if ( old != null ) {
		throw new DuplicateMappingException( "collection role", collection.getRole() );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:Configuration.java

示例6: bindManyToManySubelements

import org.hibernate.mapping.Collection; //导入方法依赖的package包/类
private static void bindManyToManySubelements(
        Collection collection,
        Element manyToManyNode,
        Mappings model) throws MappingException {
	// Bind the where
	Attribute where = manyToManyNode.attribute( "where" );
	String whereCondition = where == null ? null : where.getValue();
	collection.setManyToManyWhere( whereCondition );

	// Bind the order-by
	Attribute order = manyToManyNode.attribute( "order-by" );
	String orderFragment = order == null ? null : order.getValue();
	collection.setManyToManyOrdering( orderFragment );

	// Bind the filters
	Iterator filters = manyToManyNode.elementIterator( "filter" );
	if ( ( filters.hasNext() || whereCondition != null ) &&
	        collection.getFetchMode() == FetchMode.JOIN &&
	        collection.getElement().getFetchMode() != FetchMode.JOIN ) {
		throw new MappingException(
		        "many-to-many defining filter or where without join fetching " +
		        "not valid within collection using join fetching [" + collection.getRole() + "]"
			);
	}
	while ( filters.hasNext() ) {
		final Element filterElement = ( Element ) filters.next();
		final String name = filterElement.attributeValue( "name" );
		String condition = filterElement.getTextTrim();
		if ( StringHelper.isEmpty(condition) ) condition = filterElement.attributeValue( "condition" );
		if ( StringHelper.isEmpty(condition) ) {
			condition = model.getFilterDefinition(name).getDefaultFilterCondition();
		}
		if ( condition==null) {
			throw new MappingException("no filter condition found for filter: " + name);
		}
		log.debug(
				"Applying many-to-many filter [" + name +
				"] as [" + condition +
				"] to role [" + collection.getRole() + "]"
			);
		collection.addManyToManyFilter( name, condition );
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:44,代码来源:HbmBinder.java

示例7: addCollection

import org.hibernate.mapping.Collection; //导入方法依赖的package包/类
public void addCollection(Collection collection) throws MappingException {
	Object old = collections.put( collection.getRole(), collection );
	if ( old!=null ) {
		throw new DuplicateMappingException( "collection role", collection.getRole() );
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:7,代码来源:Mappings.java


注:本文中的org.hibernate.mapping.Collection.getRole方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。