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


Java Property.setValue方法代码示例

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


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

示例1: shallowCopy

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
/**
 * create a property copy reusing the same value
 */
public static Property shallowCopy(Property property) {
	Property clone = new Property();
	clone.setCascade( property.getCascade() );
	clone.setInsertable( property.isInsertable() );
	clone.setLazy( property.isLazy() );
	clone.setName( property.getName() );
	clone.setNodeName( property.getNodeName() );
	clone.setNaturalIdentifier( property.isNaturalIdentifier() );
	clone.setOptimisticLocked( property.isOptimisticLocked() );
	clone.setOptional( property.isOptional() );
	clone.setPersistentClass( property.getPersistentClass() );
	clone.setPropertyAccessorName( property.getPropertyAccessorName() );
	clone.setSelectable( property.isSelectable() );
	clone.setUpdateable( property.isUpdateable() );
	clone.setValue( property.getValue() );
	return clone;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:BinderHelper.java

示例2: bindCompositeId

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
private static void bindCompositeId(Element idNode, RootClass entity, Mappings mappings,
		java.util.Map inheritedMetas) throws MappingException {
	String propertyName = idNode.attributeValue( "name" );
	Component id = new Component( mappings, entity );
	entity.setIdentifier( id );
	bindCompositeId( idNode, id, entity, propertyName, mappings, inheritedMetas );
	if ( propertyName == null ) {
		entity.setEmbeddedIdentifier( id.isEmbedded() );
		if ( id.isEmbedded() ) {
			// todo : what is the implication of this?
			id.setDynamic( !entity.hasPojoRepresentation() );
			/*
			 * Property prop = new Property(); prop.setName("id");
			 * prop.setPropertyAccessorName("embedded"); prop.setValue(id);
			 * entity.setIdentifierProperty(prop);
			 */
		}
	}
	else {
		Property prop = new Property();
		prop.setValue( id );
		bindProperty( idNode, prop, mappings, inheritedMetas );
		entity.setIdentifierProperty( prop );
		entity.setDeclaredIdentifierProperty( prop );
	}

	makeIdentifier( idNode, id, mappings );

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:HbmBinder.java

示例3: bindVersioningProperty

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
private static void bindVersioningProperty(Table table, Element subnode, Mappings mappings,
		String name, RootClass entity, java.util.Map inheritedMetas) {

	String propertyName = subnode.attributeValue( "name" );
	SimpleValue val = new SimpleValue( mappings, table );
	bindSimpleValue( subnode, val, false, propertyName, mappings );
	if ( !val.isTypeSpecified() ) {
		// this is either a <version/> tag with no type attribute,
		// or a <timestamp/> tag
		if ( "version".equals( name ) ) {
			val.setTypeName( "integer" );
		}
		else {
			if ( "db".equals( subnode.attributeValue( "source" ) ) ) {
				val.setTypeName( "dbtimestamp" );
			}
			else {
				val.setTypeName( "timestamp" );
			}
		}
	}
	Property prop = new Property();
	prop.setValue( val );
	bindProperty( subnode, prop, mappings, inheritedMetas );
	// for version properties marked as being generated, make sure they are "always"
	// generated; aka, "insert" is invalid; this is dis-allowed by the DTD,
	// but just to make sure...
	if ( prop.getValueGenerationStrategy() != null ) {
		if ( prop.getValueGenerationStrategy().getGenerationTiming() == GenerationTiming.INSERT ) {
			throw new MappingException( "'generated' attribute cannot be 'insert' for versioning property" );
		}
	}
	makeVersion( subnode, val );
	entity.setVersion( prop );
	entity.addProperty( prop );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:37,代码来源:HbmBinder.java

示例4: bindCompositeId

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
private static void bindCompositeId(Element idNode, RootClass entity, Mappings mappings,
		java.util.Map inheritedMetas) throws MappingException {
	String propertyName = idNode.attributeValue( "name" );
	Component id = new Component( entity );
	entity.setIdentifier( id );
	bindCompositeId( idNode, id, entity, propertyName, mappings, inheritedMetas );
	if ( propertyName == null ) {
		entity.setEmbeddedIdentifier( id.isEmbedded() );
		if ( id.isEmbedded() ) {
			// todo : what is the implication of this?
			id.setDynamic( !entity.hasPojoRepresentation() );
			/*
			 * Property prop = new Property(); prop.setName("id");
			 * prop.setPropertyAccessorName("embedded"); prop.setValue(id);
			 * entity.setIdentifierProperty(prop);
			 */
		}
	}
	else {
		Property prop = new Property();
		prop.setValue( id );
		bindProperty( idNode, prop, mappings, inheritedMetas );
		entity.setIdentifierProperty( prop );
	}

	makeIdentifier( idNode, id, mappings );

}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:29,代码来源:HbmBinder.java

示例5: bindVersioningProperty

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
private static void bindVersioningProperty(Table table, Element subnode, Mappings mappings,
		String name, RootClass entity, java.util.Map inheritedMetas) {

	String propertyName = subnode.attributeValue( "name" );
	SimpleValue val = new SimpleValue( table );
	bindSimpleValue( subnode, val, false, propertyName, mappings );
	if ( !val.isTypeSpecified() ) {
		// this is either a <version/> tag with no type attribute,
		// or a <timestamp/> tag
		if ( "version".equals( name ) ) {
			val.setTypeName( "integer" );
		}
		else {
			if ( "db".equals( subnode.attributeValue( "source" ) ) ) {
				val.setTypeName( "dbtimestamp" );
			}
			else {
				val.setTypeName( "timestamp" );
			}
		}
	}
	Property prop = new Property();
	prop.setValue( val );
	bindProperty( subnode, prop, mappings, inheritedMetas );
	// for version properties marked as being generated, make sure they are "always"
	// generated; aka, "insert" is invalid; this is dis-allowed by the DTD,
	// but just to make sure...
	if ( prop.getGeneration() == PropertyGeneration.INSERT ) {
		throw new MappingException( "'generated' attribute cannot be 'insert' for versioning property" );
	}
	makeVersion( subnode, val );
	entity.setVersion( prop );
	entity.addProperty( prop );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:35,代码来源:HbmBinder.java

示例6: generateIdProperty

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
private Property generateIdProperty() {
	SimpleValue value = new SimpleValue();
	value.setTypeName( "long" );

	Property property = new Property();
	property.setName( "id" );
	property.setNodeName( "@id" );
	property.setValue( value );

	return property;
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:12,代码来源:Dom4jAccessorTest.java

示例7: generateTextProperty

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
private Property generateTextProperty() {
	SimpleValue value = new SimpleValue();
	value.setTypeName( "string" );

	Property property = new Property();
	property.setName( "text" );
	property.setNodeName( "." );
	property.setValue( value );

	return property;
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:12,代码来源:Dom4jAccessorTest.java

示例8: generateAccountIdProperty

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
private Property generateAccountIdProperty() {
	SimpleValue value = new SimpleValue();
	value.setTypeName( "long" );

	Property property = new Property();
	property.setName( "number" );
	property.setNodeName( "account/@num" );
	property.setValue( value );

	return property;
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:12,代码来源:Dom4jAccessorTest.java

示例9: generateNameProperty

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
private Property generateNameProperty() {
	SimpleValue value = new SimpleValue();
	value.setTypeName( "string" );

	Property property = new Property();
	property.setName( "name" );
	property.setNodeName( "name" );
	property.setValue( value );

	return property;
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:12,代码来源:Dom4jAccessorTest.java

示例10: bindSimpleId

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
private static void bindSimpleId(Element idNode, RootClass entity, Mappings mappings,
		java.util.Map inheritedMetas) throws MappingException {
	String propertyName = idNode.attributeValue( "name" );

	SimpleValue id = new SimpleValue( mappings, entity.getTable() );
	entity.setIdentifier( id );

	// if ( propertyName == null || entity.getPojoRepresentation() == null ) {
	// bindSimpleValue( idNode, id, false, RootClass.DEFAULT_IDENTIFIER_COLUMN_NAME, mappings );
	// if ( !id.isTypeSpecified() ) {
	// throw new MappingException( "must specify an identifier type: " + entity.getEntityName()
	// );
	// }
	// }
	// else {
	// bindSimpleValue( idNode, id, false, propertyName, mappings );
	// PojoRepresentation pojo = entity.getPojoRepresentation();
	// id.setTypeUsingReflection( pojo.getClassName(), propertyName );
	//
	// Property prop = new Property();
	// prop.setValue( id );
	// bindProperty( idNode, prop, mappings, inheritedMetas );
	// entity.setIdentifierProperty( prop );
	// }

	if ( propertyName == null ) {
		bindSimpleValue( idNode, id, false, RootClass.DEFAULT_IDENTIFIER_COLUMN_NAME, mappings );
	}
	else {
		bindSimpleValue( idNode, id, false, propertyName, mappings );
	}

	if ( propertyName == null || !entity.hasPojoRepresentation() ) {
		if ( !id.isTypeSpecified() ) {
			throw new MappingException( "must specify an identifier type: "
				+ entity.getEntityName() );
		}
	}
	else {
		id.setTypeUsingReflection( entity.getClassName(), propertyName );
	}

	if ( propertyName != null ) {
		Property prop = new Property();
		prop.setValue( id );
		bindProperty( idNode, prop, mappings, inheritedMetas );
		entity.setIdentifierProperty( prop );
		entity.setDeclaredIdentifierProperty( prop );
	}

	// TODO:
	/*
	 * if ( id.getHibernateType().getReturnedClass().isArray() ) throw new MappingException(
	 * "illegal use of an array as an identifier (arrays don't reimplement equals)" );
	 */
	makeIdentifier( idNode, id, mappings );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:58,代码来源:HbmBinder.java

示例11: makeProperty

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
public Property makeProperty() {
	validateMake();
	LOG.debugf( "Building property %s", name );
	Property prop = new Property();
	prop.setName( name );
	prop.setNodeName( name );
	prop.setValue( value );
	prop.setLazy( lazy );
	prop.setCascade( cascade );
	prop.setPropertyAccessorName( accessType.getType() );

	if ( property != null ) {
		prop.setValueGenerationStrategy( determineValueGenerationStrategy( property ) );
	}

	NaturalId naturalId = property != null ? property.getAnnotation( NaturalId.class ) : null;
	if ( naturalId != null ) {
		if ( ! entityBinder.isRootEntity() ) {
			throw new AnnotationException( "@NaturalId only valid on root entity (or its @MappedSuperclasses)" );
		}
		if ( ! naturalId.mutable() ) {
			updatable = false;
		}
		prop.setNaturalIdentifier( true );
	}

	// HHH-4635 -- needed for dialect-specific property ordering
	Lob lob = property != null ? property.getAnnotation( Lob.class ) : null;
	prop.setLob( lob != null );

	prop.setInsertable( insertable );
	prop.setUpdateable( updatable );

	// this is already handled for collections in CollectionBinder...
	if ( Collection.class.isInstance( value ) ) {
		prop.setOptimisticLocked( ( (Collection) value ).isOptimisticLocked() );
	}
	else {
		final OptimisticLock lockAnn = property != null
				? property.getAnnotation( OptimisticLock.class )
				: null;
		if ( lockAnn != null ) {
			//TODO this should go to the core as a mapping validation checking
			if ( lockAnn.excluded() && (
					property.isAnnotationPresent( javax.persistence.Version.class )
							|| property.isAnnotationPresent( Id.class )
							|| property.isAnnotationPresent( EmbeddedId.class ) ) ) {
				throw new AnnotationException(
						"@OptimisticLock.exclude=true incompatible with @Id, @EmbeddedId and @Version: "
								+ StringHelper.qualify( holder.getPath(), name )
				);
			}
		}
		final boolean isOwnedValue = !isToOneValue( value ) || insertable; // && updatable as well???
		final boolean includeInOptimisticLockChecks = ( lockAnn != null )
				? ! lockAnn.excluded()
				: isOwnedValue;
		prop.setOptimisticLocked( includeInOptimisticLockChecks );
	}

	LOG.tracev( "Cascading {0} with {1}", name, cascade );
	this.mappingProperty = prop;
	return prop;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:65,代码来源:PropertyBinder.java

示例12: bindSimpleId

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
private static void bindSimpleId(Element idNode, RootClass entity, Mappings mappings,
		java.util.Map inheritedMetas) throws MappingException {
	String propertyName = idNode.attributeValue( "name" );

	SimpleValue id = new SimpleValue( entity.getTable() );
	entity.setIdentifier( id );

	// if ( propertyName == null || entity.getPojoRepresentation() == null ) {
	// bindSimpleValue( idNode, id, false, RootClass.DEFAULT_IDENTIFIER_COLUMN_NAME, mappings );
	// if ( !id.isTypeSpecified() ) {
	// throw new MappingException( "must specify an identifier type: " + entity.getEntityName()
	// );
	// }
	// }
	// else {
	// bindSimpleValue( idNode, id, false, propertyName, mappings );
	// PojoRepresentation pojo = entity.getPojoRepresentation();
	// id.setTypeUsingReflection( pojo.getClassName(), propertyName );
	//
	// Property prop = new Property();
	// prop.setValue( id );
	// bindProperty( idNode, prop, mappings, inheritedMetas );
	// entity.setIdentifierProperty( prop );
	// }

	if ( propertyName == null ) {
		bindSimpleValue( idNode, id, false, RootClass.DEFAULT_IDENTIFIER_COLUMN_NAME, mappings );
	}
	else {
		bindSimpleValue( idNode, id, false, propertyName, mappings );
	}

	if ( propertyName == null || !entity.hasPojoRepresentation() ) {
		if ( !id.isTypeSpecified() ) {
			throw new MappingException( "must specify an identifier type: "
				+ entity.getEntityName() );
		}
	}
	else {
		id.setTypeUsingReflection( entity.getClassName(), propertyName );
	}

	if ( propertyName != null ) {
		Property prop = new Property();
		prop.setValue( id );
		bindProperty( idNode, prop, mappings, inheritedMetas );
		entity.setIdentifierProperty( prop );
	}

	// TODO:
	/*
	 * if ( id.getHibernateType().getReturnedClass().isArray() ) throw new MappingException(
	 * "illegal use of an array as an identifier (arrays don't reimplement equals)" );
	 */
	makeIdentifier( idNode, id, mappings );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:57,代码来源:HbmBinder.java


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