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

The following examples show how to use org.hibernate.tuple.GenerationTiming#NEVER . 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
Source File: EntityMetamodel.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
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
Source File: EntityMetamodel.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: EntityMetamodel.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private void add(InMemoryValueGenerationStrategy inMemoryStrategy) {
	if ( inMemoryStrategies == null ) {
		inMemoryStrategies = new ArrayList<>();
	}
	inMemoryStrategies.add( inMemoryStrategy );

	if ( inMemoryStrategy.getGenerationTiming() != GenerationTiming.NEVER ) {
		hadInMemoryGeneration = true;
	}
}
 
Example 4
Source File: EntityMetamodel.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private void add(InDatabaseValueGenerationStrategy inDatabaseStrategy) {
	if ( inDatabaseStrategies == null ) {
		inDatabaseStrategies = new ArrayList<>();
	}
	inDatabaseStrategies.add( inDatabaseStrategy );

	if ( inDatabaseStrategy.getGenerationTiming() != GenerationTiming.NEVER ) {
		hadInDatabaseGeneration = true;
	}
}
 
Example 5
Source File: EntityMetamodel.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
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 File: HibernatePropertyParser.java    From mPaaS with Apache License 2.0 4 votes vote down vote up
@Override
public GenerationTiming getGenerationTiming() {
	return GenerationTiming.NEVER;
}
 
Example 7
Source File: PropertyBinder.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public GenerationTiming getGenerationTiming() {
	return GenerationTiming.NEVER;
}
 
Example 8
Source File: EntityMetamodel.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public GenerationTiming getGenerationTiming() {
	return GenerationTiming.NEVER;
}
 
Example 9
Source File: EntityMetamodel.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public GenerationTiming getGenerationTiming() {
	return GenerationTiming.NEVER;
}
 
Example 10
Source File: EntityMetamodel.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public boolean isVersionGenerated() {
	final InDatabaseValueGenerationStrategy strategy = inDatabaseValueGenerationStrategies[ versionPropertyIndex ];
	return strategy != null && strategy.getGenerationTiming() != GenerationTiming.NEVER;
}
 
Example 11
Source File: SingularAttributeSourceAnyImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public GenerationTiming getGenerationTiming() {
	return GenerationTiming.NEVER;
}
 
Example 12
Source File: CompositeIdentifierSingularAttributeSourceBasicImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public GenerationTiming getGenerationTiming() {
	return GenerationTiming.NEVER;
}
 
Example 13
Source File: AbstractToOneAttributeSourceImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public GenerationTiming getGenerationTiming() {
	return GenerationTiming.NEVER;
}