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


Java Collection.getElement方法代码示例

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


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

示例1: bindUnidirectionalOneToMany

import org.hibernate.mapping.Collection; //导入方法依赖的package包/类
/**
 * Binds a unidirectional one-to-many creating a psuedo back reference property in the process.
 *
 * @param property
 * @param mappings
 * @param collection
 */
protected void bindUnidirectionalOneToMany(org.grails.datastore.mapping.model.types.OneToMany property, InFlightMetadataCollector mappings, Collection collection) {
    Value v = collection.getElement();
    v.createForeignKey();
    String entityName;
    if (v instanceof ManyToOne) {
        ManyToOne manyToOne = (ManyToOne) v;

        entityName = manyToOne.getReferencedEntityName();
    } else {
        entityName = ((OneToMany) v).getReferencedEntityName();
    }
    collection.setInverse(false);
    PersistentClass referenced = mappings.getEntityBinding(entityName);
    Backref prop = new Backref();
    PersistentEntity owner = property.getOwner();
    prop.setEntityName(owner.getName());
    prop.setName(UNDERSCORE + addUnderscore(owner.getJavaClass().getSimpleName(), property.getName()) + "Backref");
    prop.setUpdateable(false);
    prop.setInsertable(true);
    prop.setCollectionRole(collection.getRole());
    prop.setValue(collection.getKey());
    prop.setOptional(true);

    referenced.addProperty(prop);
}
 
开发者ID:grails,项目名称:gorm-hibernate5,代码行数:33,代码来源:GrailsDomainBinder.java

示例2: 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

示例3: afterConfigurationBuilt

import org.hibernate.mapping.Collection; //导入方法依赖的package包/类
public void afterConfigurationBuilt(Mappings mappings, Dialect dialect) {
	super.afterConfigurationBuilt( mappings, dialect );
	Collection children = mappings.getCollection( Parent.class.getName() + ".children" );
	Component childComponents = ( Component ) children.getElement();
	Formula f = ( Formula ) childComponents.getProperty( "bioLength" ).getValue().getColumnIterator().next();

	SQLFunction lengthFunction = ( SQLFunction ) dialect.getFunctions().get( "length" );
	if ( lengthFunction != null ) {
		ArrayList args = new ArrayList();
		args.add( "bio" );
		f.setFormula( lengthFunction.render( args, null ) );
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:14,代码来源:CompositeElementTest.java

示例4: CollectionPersisterImpl

import org.hibernate.mapping.Collection; //导入方法依赖的package包/类
public CollectionPersisterImpl(
			Collection collectionBinding,
			ManagedTypeImplementor source,
			String localName,
			CollectionRegionAccessStrategy collectionCaching,
			PersisterCreationContext creationContext) {
		super( source, localName, PropertyAccess.DUMMY );
		this.source = source;
		this.localName = localName;
		this.role = source.getNavigableName() + '.' + this.localName;
		this.collectionClassification = PersisterHelper.interpretCollectionClassification( collectionBinding );
		this.foreignKeyDescriptor = new CollectionKey( this );

		this.typeConfiguration = creationContext.getTypeConfiguration();

		this.collectionType = new CollectionTypeImpl(
				role,
				resolveCollectionJtd( creationContext, collectionClassification ),
				null,
				null
		);

		if ( collectionBinding instanceof IndexedCollection ) {
			final Value indexValueMapping = ( (IndexedCollection) collectionBinding ).getIndex();
			if ( indexValueMapping instanceof SimpleValue ) {
				final SimpleValue simpleIndexValueMapping = (SimpleValue) indexValueMapping;
//				indexAttributeConverter = simpleIndexValueMapping.getAttributeConverterDescriptor().getAttributeConverter();
			}
		}

		final Value elementValueMapping = collectionBinding.getElement();
		if ( elementValueMapping instanceof SimpleValue ) {
			final SimpleValue simpleElementValueMapping = (SimpleValue) elementValueMapping;
//			elementAttributeConverter = simpleElementValueMapping.getAttributeConverterDescriptor().getAttributeConverter();
		}
	}
 
开发者ID:hibernate,项目名称:hibernate-semantic-query,代码行数:37,代码来源:CollectionPersisterImpl.java


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