org.hibernate.boot.model.naming.PhysicalNamingStrategy Java Examples

The following examples show how to use org.hibernate.boot.model.naming.PhysicalNamingStrategy. 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: TeiidServer.java    From teiid-spring-boot with Apache License 2.0 6 votes vote down vote up
private Metadata getMetadata(Set<BeanDefinition> components, PhysicalNamingStrategy namingStrategy,
        MetadataFactory mf) {
    ServiceRegistry registry = metadataSources.getServiceRegistry();
    StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder(
            (BootstrapServiceRegistry) registry).applySetting(AvailableSettings.DIALECT, TeiidDialect.class)
            .build();
    // Generate Hibernate model based on @Entity definitions
    for (BeanDefinition c : components) {
        try {
            Class<?> clazz = Class.forName(c.getBeanClassName());
            metadataSources.addAnnotatedClass(clazz);
        } catch (ClassNotFoundException e) {
        }
    }
    return metadataSources.getMetadataBuilder(serviceRegistry).applyPhysicalNamingStrategy(namingStrategy).build();
}
 
Example #2
Source File: TeiidPostProcessor.java    From teiid-spring-boot with Apache License 2.0 6 votes vote down vote up
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
    boolean deploy = true;
    VDBMetaData vdb = this.beanFactory.getBean(VDBMetaData.class);
    TeiidServer server = this.beanFactory.getBean(TeiidServer.class);

    if (Boolean.valueOf(vdb.getPropertyValue(TeiidAutoConfiguration.IMPLICIT_VDB))) {
        PhysicalNamingStrategy namingStrategy = this.beanFactory.getBean(PhysicalNamingStrategy.class);
        deploy = server.findAndConfigureViews(vdb, event.getApplicationContext(), namingStrategy);
    }

    if (deploy) {
        // Deploy at the end when all the data sources are configured
        server.undeployVDB(TeiidConstants.VDBNAME);
        server.undeployVDB(vdb.getName(), vdb.getVersion());
        server.deployVDB(vdb, true, this.context);
    }
}
 
Example #3
Source File: EntityManagerFactoryServiceImpl.java    From multitenant with Apache License 2.0 5 votes vote down vote up
public EntityManagerFactoryServiceImpl(
		ObjectProvider<List<SchemaManagementProvider>> providers,
		ObjectProvider<PhysicalNamingStrategy> physicalNamingStrategy,
		ObjectProvider<ImplicitNamingStrategy> implicitNamingStrategy,
		ObjectProvider<List<HibernatePropertiesCustomizer>> hibernatePropertiesCustomizers) {
	this.defaultDdlAutoProvider = new HibernateDefaultDdlAutoProvider(
			providers.getIfAvailable(Collections::emptyList));
	this.physicalNamingStrategy = physicalNamingStrategy.getIfAvailable();
	this.implicitNamingStrategy = implicitNamingStrategy.getIfAvailable();
	this.hibernatePropertiesCustomizers = hibernatePropertiesCustomizers
			.getIfAvailable(() -> Collections.emptyList());
}
 
Example #4
Source File: DefaultPersistManager.java    From onedev with MIT License 5 votes vote down vote up
@Inject
public DefaultPersistManager(PhysicalNamingStrategy physicalNamingStrategy,
		HibernateProperties properties, Interceptor interceptor, 
		IdManager idManager, Dao dao, EntityValidator validator, 
		TransactionManager transactionManager) {
	this.physicalNamingStrategy = physicalNamingStrategy;
	this.properties = properties;
	this.interceptor = interceptor;
	this.idManager = idManager;
	this.dao = dao;
	this.validator = validator;
	this.transactionManager = transactionManager;
	serviceRegistry = new StandardServiceRegistryBuilder().applySettings(properties).build();
}
 
Example #5
Source File: CleanDatabase.java    From onedev with MIT License 5 votes vote down vote up
@Inject
public CleanDatabase(PhysicalNamingStrategy physicalNamingStrategy,
		HibernateProperties properties, Interceptor interceptor, 
		IdManager idManager, Dao dao, EntityValidator validator, 
		TransactionManager transactionManager) {
	super(physicalNamingStrategy, properties, interceptor, idManager, dao, validator, transactionManager);
}
 
Example #6
Source File: ApplyDatabaseConstraints.java    From onedev with MIT License 5 votes vote down vote up
@Inject
public ApplyDatabaseConstraints(PhysicalNamingStrategy physicalNamingStrategy,
		HibernateProperties properties, Interceptor interceptor, 
		IdManager idManager, Dao dao, EntityValidator validator,
		TransactionManager transactionManager) {
	super(physicalNamingStrategy, properties, interceptor, idManager, dao, validator, transactionManager);
}
 
Example #7
Source File: RestoreDatabase.java    From onedev with MIT License 5 votes vote down vote up
@Inject
public RestoreDatabase(PhysicalNamingStrategy physicalNamingStrategy,
		HibernateProperties properties, Interceptor interceptor, 
		IdManager idManager, Dao dao, EntityValidator validator, 
		TransactionManager transactionManager) {
	super(physicalNamingStrategy, properties, interceptor, idManager, dao, validator, transactionManager);
}
 
Example #8
Source File: ResetAdminPassword.java    From onedev with MIT License 5 votes vote down vote up
@Inject
public ResetAdminPassword(PhysicalNamingStrategy physicalNamingStrategy, HibernateProperties properties, 
		Interceptor interceptor, IdManager idManager, Dao dao, 
		EntityValidator validator, UserManager userManager, PasswordService passwordService, 
		TransactionManager transactionManager) {
	super(physicalNamingStrategy, properties, interceptor, idManager, dao, validator, transactionManager);
	this.userManager = userManager;
	this.passwordService = passwordService;
}
 
Example #9
Source File: Upgrade.java    From onedev with MIT License 5 votes vote down vote up
@Inject
public Upgrade(PhysicalNamingStrategy physicalNamingStrategy,
		HibernateProperties properties, Interceptor interceptor, 
		IdManager idManager, Dao dao, EntityValidator validator, 
		TransactionManager transactionManager) {
	super(physicalNamingStrategy, properties, interceptor, idManager, dao, validator, transactionManager);
}
 
Example #10
Source File: CheckDataVersion.java    From onedev with MIT License 5 votes vote down vote up
@Inject
public CheckDataVersion(PhysicalNamingStrategy physicalNamingStrategy,
		HibernateProperties properties, Interceptor interceptor, 
		IdManager idManager, Dao dao, EntityValidator validator, 
		TransactionManager transactionManager) {
	super(physicalNamingStrategy, properties, interceptor, idManager, dao, validator, transactionManager);
}
 
Example #11
Source File: BackupDatabase.java    From onedev with MIT License 5 votes vote down vote up
@Inject
public BackupDatabase(PhysicalNamingStrategy physicalNamingStrategy,
		HibernateProperties properties, Interceptor interceptor, 
		IdManager idManager, Dao dao, EntityValidator validator, 
		TransactionManager transactionManager) {
	super(physicalNamingStrategy, properties, interceptor, idManager, dao, validator, transactionManager);
}
 
Example #12
Source File: TeiidAutoConfiguration.java    From teiid-spring-boot with Apache License 2.0 5 votes vote down vote up
@Bean(name = "teiidNamingStrategy")
public PhysicalNamingStrategy teiidNamingStrategy() {
    try {
        return (PhysicalNamingStrategy) Class.forName(hibernateNamingClass).getDeclaredConstructors()[0]
                .newInstance();
    } catch (InstantiationException | IllegalAccessException | ClassNotFoundException
            | InvocationTargetException e) {
        return null;
    }
}
 
Example #13
Source File: SchemaValidatorTask.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
private void configure(MetadataBuilder metadataBuilder, StandardServiceRegistry serviceRegistry) {
	final StrategySelector strategySelector = serviceRegistry.getService( StrategySelector.class );
	if ( implicitNamingStrategy != null ) {
		metadataBuilder.applyImplicitNamingStrategy(
				strategySelector.resolveStrategy( ImplicitNamingStrategy.class, implicitNamingStrategy )
		);
	}
	if ( physicalNamingStrategy != null ) {
		metadataBuilder.applyPhysicalNamingStrategy(
				strategySelector.resolveStrategy( PhysicalNamingStrategy.class, physicalNamingStrategy )
		);
	}
}
 
Example #14
Source File: AbstractDelegatingMetadataBuildingOptions.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public PhysicalNamingStrategy getPhysicalNamingStrategy() {
	return delegate.getPhysicalNamingStrategy();
}
 
Example #15
Source File: PhysicalNamingStrategyConfiguration.java    From micronaut-data with Apache License 2.0 4 votes vote down vote up
/**
 * Default constructor.
 * @param physicalNamingStrategy The naming strategy
 */
public PhysicalNamingStrategyConfiguration(PhysicalNamingStrategy physicalNamingStrategy) {
    Objects.requireNonNull(physicalNamingStrategy, "PhysicalNamingStrategy cannot be null");
    this.physicalNamingStrategy = physicalNamingStrategy;
}
 
Example #16
Source File: Database.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public PhysicalNamingStrategy getPhysicalNamingStrategy() {
	return getBuildingOptions().getPhysicalNamingStrategy();
}
 
Example #17
Source File: MetadataBuilderImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public MetadataBuilder applyPhysicalNamingStrategy(PhysicalNamingStrategy namingStrategy) {
	this.options.physicalNamingStrategy = namingStrategy;
	return this;
}
 
Example #18
Source File: MetadataBuilderImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public PhysicalNamingStrategy getPhysicalNamingStrategy() {
	return physicalNamingStrategy;
}
 
Example #19
Source File: LocJpaConfiguration.java    From loc-framework with MIT License 4 votes vote down vote up
NamingStrategiesHibernatePropertiesCustomizer(PhysicalNamingStrategy physicalNamingStrategy,
    ImplicitNamingStrategy implicitNamingStrategy) {
  this.physicalNamingStrategy = physicalNamingStrategy;
  this.implicitNamingStrategy = implicitNamingStrategy;
}
 
Example #20
Source File: AbstractDelegatingMetadataBuilderImplementor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public MetadataBuilder applyPhysicalNamingStrategy(PhysicalNamingStrategy namingStrategy) {
	delegate.applyPhysicalNamingStrategy( namingStrategy );
	return getThis();
}
 
Example #21
Source File: Configuration.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public void setPhysicalNamingStrategy(PhysicalNamingStrategy physicalNamingStrategy) {
	this.physicalNamingStrategy = physicalNamingStrategy;
}
 
Example #22
Source File: MetadataBuilder.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Specify the PhysicalNamingStrategy to use in building the Metadata.
 * <p/>
 * Its default is defined by the {@link org.hibernate.cfg.AvailableSettings#PHYSICAL_NAMING_STRATEGY}
 * setting if using property-based configuration.
 *
 * @param namingStrategy The PhysicalNamingStrategy to apply
 *
 * @return {@code this}, for method chaining
 *
 * @see org.hibernate.cfg.AvailableSettings#PHYSICAL_NAMING_STRATEGY
 */
MetadataBuilder applyPhysicalNamingStrategy(PhysicalNamingStrategy namingStrategy);
 
Example #23
Source File: LocalSessionFactoryBean.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Set a Hibernate 5.0 PhysicalNamingStrategy for the SessionFactory.
 * @see Configuration#setPhysicalNamingStrategy
 */
public void setPhysicalNamingStrategy(PhysicalNamingStrategy physicalNamingStrategy) {
	this.physicalNamingStrategy = physicalNamingStrategy;
}
 
Example #24
Source File: LocalSessionFactoryBean.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Set a Hibernate 5 {@link PhysicalNamingStrategy} for the SessionFactory.
 * @see Configuration#setPhysicalNamingStrategy
 */
public void setPhysicalNamingStrategy(PhysicalNamingStrategy physicalNamingStrategy) {
	this.physicalNamingStrategy = physicalNamingStrategy;
}
 
Example #25
Source File: LocalSessionFactoryBean.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Set a Hibernate 5 {@link PhysicalNamingStrategy} for the SessionFactory.
 * @see Configuration#setPhysicalNamingStrategy
 */
public void setPhysicalNamingStrategy(PhysicalNamingStrategy physicalNamingStrategy) {
	this.physicalNamingStrategy = physicalNamingStrategy;
}
 
Example #26
Source File: LocalSessionFactoryBean.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Set a Hibernate 5.0 PhysicalNamingStrategy for the SessionFactory.
 * @see Configuration#setPhysicalNamingStrategy
 */
public void setPhysicalNamingStrategy(PhysicalNamingStrategy physicalNamingStrategy) {
	this.physicalNamingStrategy = physicalNamingStrategy;
}
 
Example #27
Source File: MetadataBuildingOptions.java    From lams with GNU General Public License v2.0 votes vote down vote up
PhysicalNamingStrategy getPhysicalNamingStrategy();