Java Code Examples for org.hibernate.tuple.GenerationTiming#NEVER

The following examples show how to use org.hibernate.tuple.GenerationTiming#NEVER . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public GenerationStrategyPair(
		InMemoryValueGenerationStrategy inMemoryStrategy,
		InDatabaseValueGenerationStrategy inDatabaseStrategy) {
	// perform some normalization.  Also check that only one (if any) strategy is specified
	if ( inMemoryStrategy == null ) {
		inMemoryStrategy = NoInMemoryValueGenerationStrategy.INSTANCE;
	}
	if ( inDatabaseStrategy == null ) {
		inDatabaseStrategy = NoInDatabaseValueGenerationStrategy.INSTANCE;
	}

	if ( inMemoryStrategy.getGenerationTiming() != GenerationTiming.NEVER
			&& inDatabaseStrategy.getGenerationTiming() != GenerationTiming.NEVER ) {
		throw new ValueGenerationStrategyException(
				"in-memory and in-database value generation are mutually exclusive"
		);
	}

	this.inMemoryStrategy = inMemoryStrategy;
	this.inDatabaseStrategy = inDatabaseStrategy;
}
 
Example 2
private static GenerationStrategyPair buildGenerationStrategyPair(
		final SessionFactoryImplementor sessionFactory,
		final Property mappingProperty) {
	final ValueGeneration valueGeneration = mappingProperty.getValueGenerationStrategy();
	if ( valueGeneration != null && valueGeneration.getGenerationTiming() != GenerationTiming.NEVER ) {
		// the property is generated in full. build the generation strategy pair.
		if ( valueGeneration.getValueGenerator() != null ) {
			// in-memory generation
			return new GenerationStrategyPair(
					FullInMemoryValueGenerationStrategy.create( valueGeneration )
			);
		}
		else {
			// in-db generation
			return new GenerationStrategyPair(
					create(
							sessionFactory,
							mappingProperty,
							valueGeneration
					)
			);
		}
	}
	else if ( mappingProperty.getValue() instanceof Component ) {
		final CompositeGenerationStrategyPairBuilder builder = new CompositeGenerationStrategyPairBuilder( mappingProperty );
		interpretPartialCompositeValueGeneration( sessionFactory, (Component) mappingProperty.getValue(), builder );
		return builder.buildPair();
	}

	return NO_GEN_PAIR;
}
 
Example 3
private void add(InMemoryValueGenerationStrategy inMemoryStrategy) {
	if ( inMemoryStrategies == null ) {
		inMemoryStrategies = new ArrayList<>();
	}
	inMemoryStrategies.add( inMemoryStrategy );

	if ( inMemoryStrategy.getGenerationTiming() != GenerationTiming.NEVER ) {
		hadInMemoryGeneration = true;
	}
}
 
Example 4
private void add(InDatabaseValueGenerationStrategy inDatabaseStrategy) {
	if ( inDatabaseStrategies == null ) {
		inDatabaseStrategies = new ArrayList<>();
	}
	inDatabaseStrategies.add( inDatabaseStrategy );

	if ( inDatabaseStrategy.getGenerationTiming() != GenerationTiming.NEVER ) {
		hadInDatabaseGeneration = true;
	}
}
 
Example 5
public boolean isNaturalIdentifierInsertGenerated() {
	// the intention is for this call to replace the usage of the old ValueInclusion stuff (as exposed from
	// persister) in SelectGenerator to determine if it is safe to use the natural identifier to find the
	// insert-generated identifier.  That wont work if the natural-id is also insert-generated.
	//
	// Assumptions:
	//		* That code checks that there is a natural identifier before making this call, so we assume the same here
	// 		* That code assumes a non-composite natural-id, so we assume the same here
	final InDatabaseValueGenerationStrategy strategy = inDatabaseValueGenerationStrategies[ naturalIdPropertyNumbers[0] ];
	return strategy != null && strategy.getGenerationTiming() != GenerationTiming.NEVER;
}
 
Example 6
Source Project: mPaaS   File: HibernatePropertyParser.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public GenerationTiming getGenerationTiming() {
	return GenerationTiming.NEVER;
}
 
Example 7
@Override
public GenerationTiming getGenerationTiming() {
	return GenerationTiming.NEVER;
}
 
Example 8
@Override
public GenerationTiming getGenerationTiming() {
	return GenerationTiming.NEVER;
}
 
Example 9
@Override
public GenerationTiming getGenerationTiming() {
	return GenerationTiming.NEVER;
}
 
Example 10
public boolean isVersionGenerated() {
	final InDatabaseValueGenerationStrategy strategy = inDatabaseValueGenerationStrategies[ versionPropertyIndex ];
	return strategy != null && strategy.getGenerationTiming() != GenerationTiming.NEVER;
}
 
Example 11
@Override
public GenerationTiming getGenerationTiming() {
	return GenerationTiming.NEVER;
}
 
Example 12
@Override
public GenerationTiming getGenerationTiming() {
	return GenerationTiming.NEVER;
}
 
Example 13
@Override
public GenerationTiming getGenerationTiming() {
	return GenerationTiming.NEVER;
}