Java Code Examples for org.hibernate.boot.registry.StandardServiceRegistryBuilder#configure()
The following examples show how to use
org.hibernate.boot.registry.StandardServiceRegistryBuilder#configure() .
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: SchemaExport.java From lams with GNU General Public License v2.0 | 6 votes |
private static StandardServiceRegistry buildStandardServiceRegistry(CommandLineArgs commandLineArgs) throws Exception { final BootstrapServiceRegistry bsr = new BootstrapServiceRegistryBuilder().build(); final StandardServiceRegistryBuilder ssrBuilder = new StandardServiceRegistryBuilder( bsr ); if ( commandLineArgs.cfgXmlFile != null ) { ssrBuilder.configure( commandLineArgs.cfgXmlFile ); } Properties properties = new Properties(); if ( commandLineArgs.propertiesFile != null ) { properties.load( new FileInputStream( commandLineArgs.propertiesFile ) ); } ssrBuilder.applySettings( properties ); return ssrBuilder.build(); }
Example 2
Source File: SchemaUpdateTask.java From lams with GNU General Public License v2.0 | 6 votes |
private void configure(StandardServiceRegistryBuilder registryBuilder) throws IOException { if ( configurationFile != null ) { registryBuilder.configure( configurationFile ); } Properties properties = new Properties(); if ( propertiesFile == null ) { properties.putAll( getProject().getProperties() ); } else { try (FileInputStream fip = new FileInputStream( propertiesFile )){ properties.load( fip ); } } registryBuilder.applySettings( properties ); }
Example 3
Source File: SchemaUpdate.java From lams with GNU General Public License v2.0 | 6 votes |
private static StandardServiceRegistry buildStandardServiceRegistry(CommandLineArgs parsedArgs) throws Exception { final BootstrapServiceRegistry bsr = new BootstrapServiceRegistryBuilder().build(); final StandardServiceRegistryBuilder ssrBuilder = new StandardServiceRegistryBuilder( bsr ); if ( parsedArgs.cfgXmlFile != null ) { ssrBuilder.configure( parsedArgs.cfgXmlFile ); } if ( parsedArgs.propertiesFile != null ) { Properties props = new Properties(); props.load( new FileInputStream( parsedArgs.propertiesFile ) ); ssrBuilder.applySettings( props ); } return ssrBuilder.build(); }
Example 4
Source File: SchemaValidator.java From lams with GNU General Public License v2.0 | 6 votes |
private static StandardServiceRegistry buildStandardServiceRegistry(CommandLineArgs parsedArgs) throws Exception { final BootstrapServiceRegistry bsr = new BootstrapServiceRegistryBuilder().build(); final StandardServiceRegistryBuilder ssrBuilder = new StandardServiceRegistryBuilder( bsr ); if ( parsedArgs.cfgXmlFile != null ) { ssrBuilder.configure( parsedArgs.cfgXmlFile ); } if ( parsedArgs.propertiesFile != null ) { Properties properties = new Properties(); properties.load( new FileInputStream( parsedArgs.propertiesFile ) ); ssrBuilder.applySettings( properties ); } return ssrBuilder.build(); }
Example 5
Source File: EntityManagerFactoryBuilderImpl.java From lams with GNU General Public License v2.0 | 6 votes |
@SuppressWarnings("unchecked") private void processConfigXml( LoadedConfig loadedConfig, MergedSettings mergedSettings, StandardServiceRegistryBuilder ssrBuilder) { if ( ! mergedSettings.configurationValues.containsKey( SESSION_FACTORY_NAME ) ) { // there is not already a SF-name in the merged settings final String sfName = loadedConfig.getSessionFactoryName(); if ( sfName != null ) { // but the cfg.xml file we are processing named one.. mergedSettings.configurationValues.put( SESSION_FACTORY_NAME, sfName ); } } mergedSettings.configurationValues.putAll( loadedConfig.getConfigurationValues() ); ssrBuilder.configure( loadedConfig ); }
Example 6
Source File: SchemaValidatorTask.java From lams with GNU General Public License v2.0 | 5 votes |
private void configure(StandardServiceRegistryBuilder registryBuilder) throws IOException { if ( configurationFile != null ) { registryBuilder.configure( configurationFile ); } Properties properties = new Properties(); if ( propertiesFile == null ) { properties.putAll( getProject().getProperties() ); } else { properties.load( new FileInputStream( propertiesFile ) ); } registryBuilder.applySettings( properties ); }
Example 7
Source File: HibernateL2CacheExample.java From ignite with Apache License 2.0 | 5 votes |
/** * Creates a new Hibernate {@link SessionFactory} using a programmatic * configuration. * * @param hibernateCfg Hibernate configuration file. * @return New Hibernate {@link SessionFactory}. */ private static SessionFactory createHibernateSessionFactory(URL hibernateCfg) { StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder(); builder.applySetting("hibernate.connection.url", JDBC_URL); builder.applySetting("hibernate.show_sql", true); builder.configure(hibernateCfg); return new MetadataSources(builder.build()).buildMetadata().buildSessionFactory(); }