List of usage examples for org.hibernate.boot.model.naming PhysicalNamingStrategyStandardImpl PhysicalNamingStrategyStandardImpl
PhysicalNamingStrategyStandardImpl
From source file:com.dcsbootcamp.maven.fixture.PostgresTestConfig.java
License:Apache License
/** * Provides an entity manager factory based on the data source. * * @param ds the data source//from ww w .j av a 2s .co m * @return the entity manager factory */ @Bean EntityManagerFactory entityManagerFactoryProvider(DataSource ds) { Map<String, Object> props = new HashMap<>(); props.put(Environment.DATASOURCE, ds); props.put(Environment.PHYSICAL_NAMING_STRATEGY, new PhysicalNamingStrategyStandardImpl()); props.put(Environment.IMPLICIT_NAMING_STRATEGY, new ImplicitNamingStrategyComponentPathImpl()); return createEntityManagerFactory("example.junit.spring.integrationtest", props); }
From source file:com.fitbur.testify.examples.example.junit.springboot.fixture.PostgresTestConfig.java
License:Apache License
/** * Provides an entity manager factory based on the data source. * * @param ds the data source/*from w w w . j av a 2 s.co m*/ * @return the entity manager factory */ @Bean EntityManagerFactory entityManagerFactoryProvider(DataSource ds) { Map<String, Object> props = new HashMap<>(); props.put(Environment.DATASOURCE, ds); props.put(Environment.PHYSICAL_NAMING_STRATEGY, new PhysicalNamingStrategyStandardImpl()); props.put(Environment.IMPLICIT_NAMING_STRATEGY, new ImplicitNamingStrategyComponentPathImpl()); return createEntityManagerFactory("example.junit.springboot.systemtest", props); }
From source file:com.fitbur.testify.examples.junit.spring.fixture.PostgresTestConfig.java
License:Apache License
/** * Provides an entity manager factory based on the data source. * * @param ds the data source// w ww . j a va 2 s.c om * @return the entity manager factory */ @Bean EntityManagerFactory entityManagerFactoryProvider(DataSource ds) { Map<String, Object> props = new HashMap<>(); props.put(Environment.DATASOURCE, ds); props.put(Environment.PHYSICAL_NAMING_STRATEGY, new PhysicalNamingStrategyStandardImpl()); props.put(Environment.IMPLICIT_NAMING_STRATEGY, new ImplicitNamingStrategyComponentPathImpl()); return createEntityManagerFactory("example.junit.spring.systemtest", props); }
From source file:com.fitbur.testify.fixture.common.SessionFactoryFactoryBean.java
License:Apache License
@Override public SessionFactory getObject() throws Exception { StandardServiceRegistry registry = new StandardServiceRegistryBuilder() .loadProperties("hibernate.properties").applySetting(Environment.DATASOURCE, dataSource).build(); Reflections reflections = new Reflections(DatabaseConfig.class.getPackage().getName()); MetadataSources metadataSources = new MetadataSources(registry); MetadataBuilder metadataBuilder = metadataSources.getMetadataBuilder() .applyPhysicalNamingStrategy(new PhysicalNamingStrategyStandardImpl()) .applyImplicitNamingStrategy(new ImplicitNamingStrategyComponentPathImpl()); reflections.getSubTypesOf(AttributeConverter.class).parallelStream() .forEach(metadataBuilder::applyAttributeConverter); reflections.getTypesAnnotatedWith(Entity.class).parallelStream() .forEach(metadataSources::addAnnotatedClass); Metadata metadata = metadataBuilder.build(); return metadata.buildSessionFactory(); }
From source file:com.fitbur.testify.fixture.PostgresDockerConfig.java
License:Apache License
@Bean FactoryBean<SessionFactory> sessionFactoryImplProvider(DataSource dataSource) { return new SmartFactoryBean<SessionFactory>() { @Override/*from w ww. j av a 2s . c o m*/ public boolean isPrototype() { return false; } @Override public boolean isEagerInit() { return true; } @Override public SessionFactory getObject() throws Exception { StandardServiceRegistry registry = new StandardServiceRegistryBuilder() .loadProperties("hibernate.properties").applySetting(Environment.DATASOURCE, dataSource) .build(); Reflections reflections = new Reflections(PostgresDockerConfig.class.getPackage().getName()); MetadataSources metadataSources = new MetadataSources(registry); MetadataBuilder metadataBuilder = metadataSources.getMetadataBuilder() .applyPhysicalNamingStrategy(new PhysicalNamingStrategyStandardImpl()) .applyImplicitNamingStrategy(new ImplicitNamingStrategyComponentPathImpl()); reflections.getSubTypesOf(AttributeConverter.class).parallelStream() .forEach(metadataBuilder::applyAttributeConverter); reflections.getTypesAnnotatedWith(Entity.class).parallelStream() .forEach(metadataSources::addAnnotatedClass); Metadata metadata = metadataBuilder.build(); return metadata.buildSessionFactory(); } @Override public Class<?> getObjectType() { return SessionFactory.class; } @Override public boolean isSingleton() { return true; } }; }
From source file:examples.database.EntityManagerFactoryProvider.java
License:Apache License
@Singleton @Override/*from w ww . j a v a 2 s . com*/ public EntityManagerFactory provide() { Map<String, Object> properties = new HashMap<>(); properties.put(DATASOURCE, dataSource); properties.put(PHYSICAL_NAMING_STRATEGY, new PhysicalNamingStrategyStandardImpl()); properties.put(IMPLICIT_NAMING_STRATEGY, new ImplicitNamingStrategyComponentPathImpl()); return createEntityManagerFactory("example.greeter", properties); }
From source file:examples.GreetingsModule.java
License:Apache License
@Inject void startPersistService(PersistService service, DataSource dataSource) { jpaProperties.put(DATASOURCE, dataSource); jpaProperties.put(PHYSICAL_NAMING_STRATEGY, new PhysicalNamingStrategyStandardImpl()); jpaProperties.put(IMPLICIT_NAMING_STRATEGY, new ImplicitNamingStrategyComponentPathImpl()); service.start();//from w ww . j ava2s . c om }
From source file:fixture.TestEntityFactoryManagerProvider.java
License:Apache License
@Singleton @Override//from w w w. j a v a2 s . co m public EntityManagerFactory provide() { Map<String, Object> properties = new HashMap<>(); properties.put(DATASOURCE, dataSource); properties.put(PHYSICAL_NAMING_STRATEGY, new PhysicalNamingStrategyStandardImpl()); properties.put(IMPLICIT_NAMING_STRATEGY, new ImplicitNamingStrategyComponentPathImpl()); properties.put("hibernate.ejb.entitymanager_factory_name", serviceLocator.getName()); return createEntityManagerFactory("test.example.greeter", properties); }
From source file:fixture.TestEntityManagerFactoryProvider.java
License:Apache License
@Singleton @Override/* w w w. java2s. c om*/ public EntityManagerFactory provide() { Map<String, Object> properties = new HashMap<>(); properties.put(DATASOURCE, dataSource); properties.put(PHYSICAL_NAMING_STRATEGY, new PhysicalNamingStrategyStandardImpl()); properties.put(IMPLICIT_NAMING_STRATEGY, new ImplicitNamingStrategyComponentPathImpl()); properties.put(HBM2DDL_LOAD_SCRIPT_SOURCE, "META-INF/postgresql-test-data.sql"); return createEntityManagerFactory("example.greetings", properties); }