类org.hibernate.mapping.List源码实例Demo

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

源代码1 项目: cacheonix-core   文件: ValueVisitorTest.java
public void testProperCallbacks() {

		ValueVisitor vv = new ValueVisitorValidator();
		
		new Any(new Table()).accept(vv);
		new Array(new RootClass()).accept(vv);
		new Bag(new RootClass()).accept(vv);
		new Component(new RootClass()).accept(vv);
		new DependantValue(null,null).accept(vv);
		new IdentifierBag(null).accept(vv);
		new List(null).accept(vv);
		new ManyToOne(null).accept(vv);
		new Map(null).accept(vv);
		new OneToMany(null).accept(vv);
		new OneToOne(null, new RootClass() ).accept(vv);
		new PrimitiveArray(null).accept(vv);
		new Set(null).accept(vv);
		new SimpleValue().accept(vv);
	
		
	}
 
源代码2 项目: cacheonix-core   文件: HbmBinder.java
/**
 * Called for Lists, arrays, primitive arrays
 */
public static void bindListSecondPass(Element node, List list, java.util.Map classes,
		Mappings mappings, java.util.Map inheritedMetas) throws MappingException {

	bindCollectionSecondPass( node, list, classes, mappings, inheritedMetas );

	Element subnode = node.element( "list-index" );
	if ( subnode == null ) subnode = node.element( "index" );
	SimpleValue iv = new SimpleValue( list.getCollectionTable() );
	bindSimpleValue(
			subnode,
			iv,
			list.isOneToMany(),
			IndexedCollection.DEFAULT_INDEX_COLUMN_NAME,
			mappings
		);
	iv.setTypeName( "integer" );
	list.setIndex( iv );
	String baseIndex = subnode.attributeValue( "base" );
	if ( baseIndex != null ) list.setBaseIndex( Integer.parseInt( baseIndex ) );
	list.setIndexNodeName( subnode.attributeValue("node") );

	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( '_' + node.attributeValue( "name" ) + "IndexBackref" );
		ib.setUpdateable( false );
		ib.setSelectable( false );
		ib.setCollectionRole( list.getRole() );
		ib.setEntityName( list.getOwner().getEntityName() );
		ib.setValue( list.getIndex() );
		// ( (Column) ( (SimpleValue) ic.getIndex() ).getColumnIterator().next()
		// ).setNullable(false);
		referenced.addProperty( ib );
	}
}
 
源代码3 项目: cacheonix-core   文件: HbmBinder.java
public void secondPass(java.util.Map persistentClasses, java.util.Map inheritedMetas)
		throws MappingException {
	HbmBinder.bindListSecondPass(
			node,
			(List) collection,
			persistentClasses,
			mappings,
			inheritedMetas 
		);
}
 
源代码4 项目: lams   文件: ListBinder.java
@Override
protected Collection createCollection(PersistentClass persistentClass) {
	return new org.hibernate.mapping.List( getBuildingContext(), persistentClass );
}
 
源代码5 项目: lams   文件: ListBinder.java
private void bindIndex(final MetadataBuildingContext buildingContext) {
	if ( !indexColumn.isImplicit() ) {
		PropertyHolder valueHolder = PropertyHolderBuilder.buildPropertyHolder(
				this.collection,
				StringHelper.qualify( this.collection.getRole(), "key" ),
				null,
				null,
				propertyHolder,
				getBuildingContext()
		);
		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.setBuildingContext( getBuildingContext() );
		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 = buildingContext.getMetadataCollector().getEntityBinding( 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()
		);
	}
}
 
源代码6 项目: cacheonix-core   文件: HbmBinder.java
ListSecondPass(Element node, Mappings mappings, List collection, java.util.Map inheritedMetas) {
	super( node, mappings, collection, inheritedMetas );
}
 
源代码7 项目: cacheonix-core   文件: HbmBinder.java
public Collection create(Element node, String path, PersistentClass owner,
		Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
	List list = new List( owner );
	bindCollection( node, list, owner.getEntityName(), path, mappings, inheritedMetas );
	return list;
}
 
源代码8 项目: cacheonix-core   文件: ValueVisitorTest.java
public Object accept(List list) {
	return validate(List.class, list);

}
 
 类所在包
 类方法
 同包方法