org.hibernate.id.factory.spi.MutableIdentifierGeneratorFactory Java Examples

The following examples show how to use org.hibernate.id.factory.spi.MutableIdentifierGeneratorFactory. 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: FastBootMetadataBuilder.java    From quarkus with Apache License 2.0 6 votes vote down vote up
private void registerIdentifierGenerators(StandardServiceRegistry ssr) {
    final StrategySelector strategySelector = ssr.getService(StrategySelector.class);

    // apply id generators
    final Object idGeneratorStrategyProviderSetting = buildTimeSettings
            .get(AvailableSettings.IDENTIFIER_GENERATOR_STRATEGY_PROVIDER);
    if (idGeneratorStrategyProviderSetting != null) {
        final IdentifierGeneratorStrategyProvider idGeneratorStrategyProvider = strategySelector
                .resolveStrategy(IdentifierGeneratorStrategyProvider.class, idGeneratorStrategyProviderSetting);
        final MutableIdentifierGeneratorFactory identifierGeneratorFactory = ssr
                .getService(MutableIdentifierGeneratorFactory.class);
        if (identifierGeneratorFactory == null) {
            throw persistenceException("Application requested custom identifier generator strategies, "
                    + "but the MutableIdentifierGeneratorFactory could not be found");
        }
        for (Map.Entry<String, Class<?>> entry : idGeneratorStrategyProvider.getStrategies().entrySet()) {
            identifierGeneratorFactory.register(entry.getKey(), entry.getValue());
        }
    }
}
 
Example #2
Source File: EntityManagerFactoryBuilderImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private void configure(StandardServiceRegistry ssr, MergedSettings mergedSettings) {
	final StrategySelector strategySelector = ssr.getService( StrategySelector.class );

	// apply id generators
	final Object idGeneratorStrategyProviderSetting = configurationValues.remove( AvailableSettings.IDENTIFIER_GENERATOR_STRATEGY_PROVIDER );
	if ( idGeneratorStrategyProviderSetting != null ) {
		final IdentifierGeneratorStrategyProvider idGeneratorStrategyProvider =
				strategySelector.resolveStrategy( IdentifierGeneratorStrategyProvider.class, idGeneratorStrategyProviderSetting );
		final MutableIdentifierGeneratorFactory identifierGeneratorFactory = ssr.getService( MutableIdentifierGeneratorFactory.class );
		if ( identifierGeneratorFactory == null ) {
			throw persistenceException(
					"Application requested custom identifier generator strategies, " +
							"but the MutableIdentifierGeneratorFactory could not be found"
			);
		}
		for ( Map.Entry<String,Class<?>> entry : idGeneratorStrategyProvider.getStrategies().entrySet() ) {
			identifierGeneratorFactory.register( entry.getKey(), entry.getValue() );
		}
	}
}
 
Example #3
Source File: InFlightMetadataCollectorImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public InFlightMetadataCollectorImpl(
		BootstrapContext bootstrapContext,
		MetadataBuildingOptions options) {
	this.bootstrapContext = bootstrapContext;
	this.uuid = UUID.randomUUID();
	this.options = options;

	this.identifierGeneratorFactory = options.getServiceRegistry()
			.getService( MutableIdentifierGeneratorFactory.class );

	for ( Map.Entry<String, SQLFunction> sqlFunctionEntry : bootstrapContext.getSqlFunctions().entrySet() ) {
		if ( sqlFunctionMap == null ) {
			// we need this to be a ConcurrentHashMap for the one we ultimately pass along to the SF
			// but is this the reference that gets passed along?
			sqlFunctionMap = new ConcurrentHashMap<>( 16, .75f, 1 );
		}
		sqlFunctionMap.put( sqlFunctionEntry.getKey(), sqlFunctionEntry.getValue() );
	}

	bootstrapContext.getAuxiliaryDatabaseObjectList().forEach( getDatabase()::addAuxiliaryDatabaseObject );
}
 
Example #4
Source File: ReactiveIdentifierGeneratorFactoryInitiator.java    From hibernate-reactive with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public Class<MutableIdentifierGeneratorFactory> getServiceInitiated() {
	return MutableIdentifierGeneratorFactory.class;
}
 
Example #5
Source File: ReactiveIdentifierGeneratorFactoryInitiator.java    From hibernate-reactive with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public MutableIdentifierGeneratorFactory initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
	return new ReactiveIdentifierGeneratorFactory();
}
 
Example #6
Source File: QuarkusMutableIdentifierGeneratorFactoryInitiator.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public MutableIdentifierGeneratorFactory initiateService(final Map configurationValues,
        final ServiceRegistryImplementor registry) {
    return sfScopedSingleton;
}
 
Example #7
Source File: QuarkusMutableIdentifierGeneratorFactoryInitiator.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public Class<MutableIdentifierGeneratorFactory> getServiceInitiated() {
    return MutableIdentifierGeneratorFactory.class;
}
 
Example #8
Source File: MutableIdentifierGeneratorFactoryInitiator.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Class<MutableIdentifierGeneratorFactory> getServiceInitiated() {
	return MutableIdentifierGeneratorFactory.class;
}
 
Example #9
Source File: MutableIdentifierGeneratorFactoryInitiator.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public MutableIdentifierGeneratorFactory initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
	return new DefaultIdentifierGeneratorFactory();
}
 
Example #10
Source File: MetadataImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
MetadataImpl(
		UUID uuid,
		MetadataBuildingOptions metadataBuildingOptions,
		MutableIdentifierGeneratorFactory identifierGeneratorFactory,
		Map<String, PersistentClass> entityBindingMap,
		Map<Class, MappedSuperclass> mappedSuperclassMap,
		Map<String, Collection> collectionBindingMap,
		Map<String, TypeDefinition> typeDefinitionMap,
		Map<String, FilterDefinition> filterDefinitionMap,
		Map<String, FetchProfile> fetchProfileMap,
		Map<String, String> imports,
		Map<String, IdentifierGeneratorDefinition> idGeneratorDefinitionMap,
		Map<String, NamedQueryDefinition> namedQueryMap,
		Map<String, NamedSQLQueryDefinition> namedNativeQueryMap,
		Map<String, NamedProcedureCallDefinition> namedProcedureCallMap,
		Map<String, ResultSetMappingDefinition> sqlResultSetMappingMap,
		Map<String, NamedEntityGraphDefinition> namedEntityGraphMap,
		Map<String, SQLFunction> sqlFunctionMap,
		java.util.Collection<DomainDataRegionConfigImpl.Builder> cacheRegionConfigBuilders,
		Database database,
		BootstrapContext bootstrapContext) {
	this.uuid = uuid;
	this.metadataBuildingOptions = metadataBuildingOptions;
	this.identifierGeneratorFactory = identifierGeneratorFactory;
	this.entityBindingMap = entityBindingMap;
	this.mappedSuperclassMap = mappedSuperclassMap;
	this.collectionBindingMap = collectionBindingMap;
	this.typeDefinitionMap = typeDefinitionMap;
	this.filterDefinitionMap = filterDefinitionMap;
	this.fetchProfileMap = fetchProfileMap;
	this.imports = imports;
	this.idGeneratorDefinitionMap = idGeneratorDefinitionMap;
	this.namedQueryMap = namedQueryMap;
	this.namedNativeQueryMap = namedNativeQueryMap;
	this.namedProcedureCallMap = namedProcedureCallMap;
	this.sqlResultSetMappingMap = sqlResultSetMappingMap;
	this.namedEntityGraphMap = namedEntityGraphMap;
	this.sqlFunctionMap = sqlFunctionMap;
	this.cacheRegionConfigBuilders = cacheRegionConfigBuilders;
	this.database = database;
	this.bootstrapContext = bootstrapContext;
}