/** * Get an instance of the dialect specified by the current <tt>System</tt> properties. * * @return The specified Dialect * @throws HibernateException If no dialect was specified, or if it could not be instantiated. */ public static Dialect getDialect() throws HibernateException { return instantiateDialect( Environment.getProperties().getProperty( Environment.DIALECT ) ); }
/** * Create a builder with the specified bootstrap services. * * @param bootstrapServiceRegistry Provided bootstrap registry to use. */ public StandardServiceRegistryBuilder( BootstrapServiceRegistry bootstrapServiceRegistry, LoadedConfig loadedConfigBaseline) { this.settings = Environment.getProperties(); this.bootstrapServiceRegistry = bootstrapServiceRegistry; this.configLoader = new ConfigLoader( bootstrapServiceRegistry ); this.aggregatedCfgXml = loadedConfigBaseline; }
public AbstractServiceRegistryImpl( BootstrapServiceRegistry bootstrapServiceRegistry, boolean autoCloseRegistry) { if ( ! ServiceRegistryImplementor.class.isInstance( bootstrapServiceRegistry ) ) { throw new IllegalArgumentException( "ServiceRegistry parent needs to implement ServiceRegistryImplementor" ); } this.parent = (ServiceRegistryImplementor) bootstrapServiceRegistry; this.allowCrawling = ConfigurationHelper.getBoolean( ALLOW_CRAWLING, Environment.getProperties(), true ); this.autoCloseRegistry = autoCloseRegistry; this.parent.registerChild( this ); }
protected AbstractServiceRegistryImpl( ServiceRegistryImplementor parent, boolean autoCloseRegistry) { this.parent = parent; this.allowCrawling = ConfigurationHelper.getBoolean( ALLOW_CRAWLING, Environment.getProperties(), true ); this.autoCloseRegistry = autoCloseRegistry; this.parent.registerChild( this ); }
@Override protected void addConfigOptions(Map options) { super.addConfigOptions( options ); // Creates new schema after establishing connection options.putAll( Environment.getProperties() ); options.put( EnversSettings.DEFAULT_SCHEMA, SCHEMA_NAME ); }
@Override protected DataSource dataSource() { DataSource dataSource = ReflectionUtil.newInstance( "com.microsoft.sqlserver.jdbc.SQLServerDataSource" ); ReflectionUtil.setProperty( dataSource, "URL", Environment.getProperties().getProperty( AvailableSettings.URL ) ); ReflectionUtil.setProperty( dataSource, "user", Environment.getProperties().getProperty( AvailableSettings.USER ) ); ReflectionUtil.setProperty( dataSource, "password", Environment.getProperties().getProperty( AvailableSettings.PASS ) ); return dataSource; } }
@Override protected DataSource dataSource() { DataSource dataSource = ReflectionUtil.newInstance( "org.h2.jdbcx.JdbcDataSource" ); ReflectionUtil.setProperty( dataSource, "URL", Environment.getProperties().getProperty( AvailableSettings.URL ) ); ReflectionUtil.setProperty( dataSource, "user", Environment.getProperties().getProperty( AvailableSettings.USER ) ); ReflectionUtil.setProperty( dataSource, "password", Environment.getProperties().getProperty( AvailableSettings.PASS ) ); return dataSource; } }
@Override protected DataSource dataSource() { DataSource dataSource = ReflectionUtil.newInstance( "org.postgresql.ds.PGSimpleDataSource" ); ReflectionUtil.setProperty( dataSource, "url", Environment.getProperties().getProperty( AvailableSettings.URL ) ); ReflectionUtil.setProperty( dataSource, "user", Environment.getProperties().getProperty( AvailableSettings.USER ) ); ReflectionUtil.setProperty( dataSource, "password", Environment.getProperties().getProperty( AvailableSettings.PASS ) ); return dataSource; } }
public static ServiceRegistryTestingImpl forUnitTesting() { return new ServiceRegistryTestingImpl( true, new BootstrapServiceRegistryBuilder().build(), StandardServiceInitiators.LIST, Arrays.asList( dialectFactoryService(), connectionProviderService() ), Environment.getProperties() ); }
@Before public void setUp() { Map<Object, Object> properties = new HashMap<>( Environment.getProperties() ); properties.put( AvailableSettings.HBM2DDL_CHARSET_NAME, charsetName() ); serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( properties ); }
@Before public void setUp() { serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( Environment.getProperties() ); }
@Before public void setUp() { serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( Environment.getProperties() ); }
@Before public void setUp() { serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( Environment.getProperties() ); }
@Before public void setUp() { Map settings = new HashMap(); settings.putAll( Environment.getProperties() ); settings.put( AvailableSettings.DIALECT, H2Dialect.class.getName() ); settings.put( AvailableSettings.FORMAT_SQL, false ); this.serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( settings ); MetadataSources ms = new MetadataSources( serviceRegistry ); ms.addAnnotatedClass( Schema1Entity1.class ); ms.addAnnotatedClass( Schema2Entity2.class ); this.metadata = ms.buildMetadata(); }
@Override public void buildEntityManagerFactory() { connectionProvider = new DriverManagerConnectionProviderImpl(); connectionProvider.configure( Environment.getProperties() ); try(Connection connection = connectionProvider.getConnection(); Statement statement = connection.createStatement()) { statement.execute( "DROP TABLE IF EXISTS roles CASCADE" ); statement.execute( "CREATE TABLE roles ( id BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY )" ); } catch (SQLException e) { fail(e.getMessage()); } super.buildEntityManagerFactory(); }
public SchemaFilterTest() { Map settings = new HashMap(); settings.putAll( Environment.getProperties() ); settings.put( AvailableSettings.DIALECT, SQLServerDialect.class.getName() ); settings.put( AvailableSettings.FORMAT_SQL, false ); this.serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( settings ); MetadataSources ms = new MetadataSources( serviceRegistry ); ms.addAnnotatedClass( SchemaNoneEntity0.class ); ms.addAnnotatedClass( Schema1Entity1.class ); ms.addAnnotatedClass( Schema1Entity2.class ); ms.addAnnotatedClass( Schema2Entity3.class ); ms.addAnnotatedClass( Schema2Entity4.class ); this.metadata = ms.buildMetadata(); }
private SessionFactory buildSessionFactory() { Map settings = new HashMap(); settings.putAll( Environment.getProperties() ); TestingJtaBootstrap.prepare( settings ); settings.put( AvailableSettings.TRANSACTION_COORDINATOR_STRATEGY, "jta" ); final StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().applySettings( settings ).build(); return new MetadataSources( ssr ) .addAnnotatedClass( TestEntity.class ) .buildMetadata() .buildSessionFactory(); }
@Before public void setUp() { serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( Environment.getProperties() ); metadata = (MetadataImplementor) new MetadataSources( serviceRegistry ) .addResource( "org/hibernate/test/schemaupdate/mapping.hbm.xml" ) .buildMetadata(); metadata.validate(); new SchemaExport().drop( EnumSet.of( TargetType.DATABASE, TargetType.STDOUT ), metadata ); }
@Before public void setUp() { serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( Environment.getProperties() ); metadata = (MetadataImplementor) new MetadataSources( serviceRegistry ) .addAnnotatedClass( MyEntity.class ).buildMetadata(); metadata.validate(); }
@After public void tearDown() { ServiceRegistry serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( Environment.getProperties() ); try { MetadataImplementor metadata = (MetadataImplementor) new MetadataSources( serviceRegistry ) .addAnnotatedClass( TestEntity.class ) .buildMetadata(); metadata.validate(); new SchemaExport().drop( EnumSet.of( TargetType.DATABASE, TargetType.STDOUT ), metadata ); } finally { ServiceRegistryBuilder.destroy( serviceRegistry ); } }