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

The following examples show how to use org.hibernate.boot.model.naming.PhysicalNamingStrategy. 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
Source Project: teiid-spring-boot   Source File: TeiidServer.java    License: 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 Project: teiid-spring-boot   Source File: TeiidPostProcessor.java    License: 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 Project: onedev   Source File: DefaultPersistManager.java    License: 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 4
Source Project: onedev   Source File: CleanDatabase.java    License: 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 5
Source Project: onedev   Source File: ApplyDatabaseConstraints.java    License: 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 6
Source Project: onedev   Source File: RestoreDatabase.java    License: 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 7
Source Project: onedev   Source File: ResetAdminPassword.java    License: 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 8
Source Project: onedev   Source File: Upgrade.java    License: 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 9
Source Project: onedev   Source File: CheckDataVersion.java    License: 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 10
Source Project: onedev   Source File: BackupDatabase.java    License: 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 11
Source Project: teiid-spring-boot   Source File: TeiidAutoConfiguration.java    License: 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 12
Source Project: lams   Source File: SchemaValidatorTask.java    License: 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 13
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 14
/**
 * Default constructor.
 * @param physicalNamingStrategy The naming strategy
 */
public PhysicalNamingStrategyConfiguration(PhysicalNamingStrategy physicalNamingStrategy) {
    Objects.requireNonNull(physicalNamingStrategy, "PhysicalNamingStrategy cannot be null");
    this.physicalNamingStrategy = physicalNamingStrategy;
}
 
Example 15
Source Project: lams   Source File: Configuration.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void setPhysicalNamingStrategy(PhysicalNamingStrategy physicalNamingStrategy) {
	this.physicalNamingStrategy = physicalNamingStrategy;
}
 
Example 16
@Override
public MetadataBuilder applyPhysicalNamingStrategy(PhysicalNamingStrategy namingStrategy) {
	delegate.applyPhysicalNamingStrategy( namingStrategy );
	return getThis();
}
 
Example 17
@Override
public PhysicalNamingStrategy getPhysicalNamingStrategy() {
	return delegate.getPhysicalNamingStrategy();
}
 
Example 18
Source Project: lams   Source File: Database.java    License: GNU General Public License v2.0 4 votes vote down vote up
public PhysicalNamingStrategy getPhysicalNamingStrategy() {
	return getBuildingOptions().getPhysicalNamingStrategy();
}
 
Example 19
Source Project: lams   Source File: MetadataBuilderImpl.java    License: 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 20
Source Project: lams   Source File: MetadataBuilderImpl.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public PhysicalNamingStrategy getPhysicalNamingStrategy() {
	return physicalNamingStrategy;
}
 
Example 21
Source Project: loc-framework   Source File: LocJpaConfiguration.java    License: MIT License 4 votes vote down vote up
NamingStrategiesHibernatePropertiesCustomizer(PhysicalNamingStrategy physicalNamingStrategy,
    ImplicitNamingStrategy implicitNamingStrategy) {
  this.physicalNamingStrategy = physicalNamingStrategy;
  this.implicitNamingStrategy = implicitNamingStrategy;
}
 
Example 22
Source Project: spring-analysis-note   Source File: LocalSessionFactoryBean.java    License: 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 23
Source Project: java-technology-stack   Source File: LocalSessionFactoryBean.java    License: 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 24
Source Project: lams   Source File: LocalSessionFactoryBean.java    License: 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 25
Source Project: lams   Source File: MetadataBuilder.java    License: 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 26
/**
 * Set a Hibernate 5.0 PhysicalNamingStrategy for the SessionFactory.
 * @see Configuration#setPhysicalNamingStrategy
 */
public void setPhysicalNamingStrategy(PhysicalNamingStrategy physicalNamingStrategy) {
	this.physicalNamingStrategy = physicalNamingStrategy;
}
 
Example 27
PhysicalNamingStrategy getPhysicalNamingStrategy();