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


Java GenerationTiming.ALWAYS属性代码示例

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


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

示例1: determineValueGenerationStrategy

private ValueGeneration determineValueGenerationStrategy(XProperty property) {
	ValueGeneration valueGeneration = getValueGenerationFromAnnotations( property );

	if ( valueGeneration == null ) {
		return NoValueGeneration.INSTANCE;
	}

	final GenerationTiming when = valueGeneration.getGenerationTiming();

	if ( valueGeneration.getValueGenerator() == null ) {
		insertable = false;
		if ( when == GenerationTiming.ALWAYS ) {
			updatable = false;
		}
	}

	return valueGeneration;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:PropertyBinder.java

示例2: timingsMatch

private boolean timingsMatch(GenerationTiming timing, GenerationTiming matchTiming) {
	return
			(matchTiming == GenerationTiming.INSERT && timing.includesInsert()) ||
					(matchTiming == GenerationTiming.ALWAYS && timing.includesUpdate());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:AbstractEntityPersister.java

示例3: buildPair

public GenerationStrategyPair buildPair() {
	if ( hadInMemoryGeneration && hadInDatabaseGeneration ) {
		throw new ValueGenerationStrategyException(
				"Composite attribute [" + mappingProperty.getName() + "] contained both in-memory"
						+ " and in-database value generation"
		);
	}
	else if ( hadInMemoryGeneration ) {
		throw new NotYetImplementedException( "Still need to wire in composite in-memory value generation" );

	}
	else if ( hadInDatabaseGeneration ) {
		final Component composite = (Component) mappingProperty.getValue();

		// we need the numbers to match up so we can properly handle 'referenced sql column values'
		if ( inDatabaseStrategies.size() != composite.getPropertySpan() ) {
			throw new ValueGenerationStrategyException(
					"Internal error : mismatch between number of collected in-db generation strategies" +
							" and number of attributes for composite attribute : " + mappingProperty.getName()
			);
		}

		// the base-line values for the aggregated InDatabaseValueGenerationStrategy we will build here.
		GenerationTiming timing = GenerationTiming.INSERT;
		boolean referenceColumns = false;
		String[] columnValues = new String[ composite.getColumnSpan() ];

		// start building the aggregate values
		int propertyIndex = -1;
		int columnIndex = 0;
		Iterator subProperties = composite.getPropertyIterator();
		while ( subProperties.hasNext() ) {
			propertyIndex++;
			final Property subProperty = (Property) subProperties.next();
			final InDatabaseValueGenerationStrategy subStrategy = inDatabaseStrategies.get( propertyIndex );

			if ( subStrategy.getGenerationTiming() == GenerationTiming.ALWAYS ) {
				// override the base-line to the more often "ALWAYS"...
				timing = GenerationTiming.ALWAYS;

			}
			if ( subStrategy.referenceColumnsInSql() ) {
				// override base-line value
				referenceColumns = true;
			}
			if ( subStrategy.getReferencedColumnValues() != null ) {
				if ( subStrategy.getReferencedColumnValues().length != subProperty.getColumnSpan() ) {
					throw new ValueGenerationStrategyException(
							"Internal error : mismatch between number of collected 'referenced column values'" +
									" and number of columns for composite attribute : " + mappingProperty.getName() +
									'.' + subProperty.getName()
					);
				}
				System.arraycopy(
						subStrategy.getReferencedColumnValues(),
						0,
						columnValues,
						columnIndex,
						subProperty.getColumnSpan()
				);
			}
		}

		// then use the aggregated values to build the InDatabaseValueGenerationStrategy
		return new GenerationStrategyPair(
				new InDatabaseValueGenerationStrategyImpl( timing, referenceColumns, columnValues )
		);
	}
	else {
		return NO_GEN_PAIR;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:72,代码来源:EntityMetamodel.java

示例4: isUpdateGenerated

private static boolean isUpdateGenerated(Property property) {
	return property.getValueGenerationStrategy() != null
			&& property.getValueGenerationStrategy().getGenerationTiming() == GenerationTiming.ALWAYS;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:EntityMetamodel.java

示例5: getGenerationTiming

public GenerationTiming getGenerationTiming() {
	return GenerationTiming.ALWAYS;
}
 
开发者ID:brmeyer,项目名称:HibernateDemos,代码行数:3,代码来源:ModifiedByValueGeneration.java


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