protected final Configuration buildConfiguration() { Configuration cfg = new Configuration().setProperties( buildProperties() ); String[] mappingFiles = ConfigurationHelper.toStringArray( mapResources, " ,\n\t\r\f" ); for ( int i = 0; i < mappingFiles.length; i++ ) { cfg.addResource( mappingFiles[i] ); } return cfg; }
@Before public void setup(){ cfg=new Configuration(); Properties p = new Properties(); p.put( Environment.DIALECT, "org.hibernate.dialect.HSQLDialect" ); p.put( "hibernate.connection.driver_class", "org.h2.Driver" ); p.put( "hibernate.connection.url", "jdbc:h2:mem:" ); p.put( "hibernate.connection.username", "sa" ); p.put( "hibernate.connection.password", "" ); cfg.setProperties(p); serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( cfg.getProperties() ); }
@Override public AnnotationConfiguration setProperties(Properties properties) { super.setProperties( properties ); return this; }
@Override public AnnotationConfiguration setProperties(Properties properties) { super.setProperties( properties ); return this; }
@Override public AnnotationConfiguration setProperties(Properties properties) { super.setProperties( properties ); return this; }
public Ejb3Configuration setProperties(Properties properties) { cfg.setProperties( properties ); return this; }
@Override public Configuration setProperties(Properties properties) { super.setProperties(properties); return this; }
private SchemaValidator getSchemaValidator(Configuration cfg) throws HibernateException, IOException { Properties properties = new Properties(); properties.putAll( cfg.getProperties() ); if (propertiesFile == null) { properties.putAll( getProject().getProperties() ); } else { properties.load( new FileInputStream(propertiesFile) ); } cfg.setProperties(properties); return new SchemaValidator(cfg); }
private SchemaValidator getSchemaValidator(Configuration cfg) throws HibernateException, IOException { Properties properties = new Properties(); properties.putAll( cfg.getProperties() ); if (propertiesFile == null) { properties.putAll( getProject().getProperties() ); } else { properties.load( new FileInputStream(propertiesFile) ); } cfg.setProperties(properties); return new SchemaValidator(cfg); }
private SchemaUpdate getSchemaUpdate(Configuration cfg) throws HibernateException, IOException { Properties properties = new Properties(); properties.putAll( cfg.getProperties() ); if (propertiesFile == null) { properties.putAll( getProject().getProperties() ); } else { properties.load( new FileInputStream(propertiesFile) ); } cfg.setProperties(properties); return new SchemaUpdate(cfg); }
private SchemaValidator getSchemaValidator(Configuration cfg) throws HibernateException, IOException { Properties properties = new Properties(); properties.putAll( cfg.getProperties() ); if (propertiesFile == null) { properties.putAll( getProject().getProperties() ); } else { properties.load( new FileInputStream(propertiesFile) ); } cfg.setProperties(properties); return new SchemaValidator(cfg); }
private Configuration buildConfiguration(final Set<String> managedClasses) { final Configuration cfg = new Configuration(); final Properties properties = new Properties(); properties.putAll(configuration); for (final String entity : managedClasses) { cfg.addAnnotatedClass(getMappedClass(entity)); } cfg.setProperties(properties); return cfg; }
private Configuration buildConfiguration(final Set<String> managedClasses) { final Configuration cfg = new Configuration(); final Properties properties = new Properties(); properties.putAll(configuration); for (final String entity : managedClasses) { cfg.addAnnotatedClass(getMappedClass(entity)); } cfg.setProperties(properties); return cfg; }
public static void main(String[] args) throws IOException { Configuration cfg = Persistor.createConfiguration(); Properties props = ResourceUtil.getProps("tmp/hibernate.properties"); cfg.setProperties(props); TableCreator tc = new TableCreator(cfg); tc.createTables("src/test/sql/audit_tables.sql-" + AuditServerConstants.ISODATE_SDF.format(new Date())); } }
private SchemaExport getSchemaExport(Configuration cfg) throws HibernateException, IOException { Properties properties = new Properties(); properties.putAll( cfg.getProperties() ); if (propertiesFile == null) { properties.putAll( getProject().getProperties() ); } else { properties.load( new FileInputStream(propertiesFile) ); } cfg.setProperties(properties); return new SchemaExport(cfg) .setHaltOnError(haltOnError) .setOutputFile( outputFile.getPath() ) .setDelimiter(delimiter); }
private SchemaExport getSchemaExport(Configuration cfg) throws HibernateException, IOException { Properties properties = new Properties(); properties.putAll( cfg.getProperties() ); if (propertiesFile == null) { properties.putAll( getProject().getProperties() ); } else { properties.load( new FileInputStream(propertiesFile) ); } cfg.setProperties(properties); return new SchemaExport(cfg) .setHaltOnError(haltOnError) .setOutputFile( outputFile.getPath() ) .setDelimiter(delimiter); }
private static SessionFactory buildSessionAnnotationFactory() { try { Properties dbProps = ConfigSettings.getDatabaseProperties(); Configuration configuration = new Configuration(); configuration.setProperties(dbProps); configuration.configure("hibernate-annotation.cfg.xml"); ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build(); sessionFactory = configuration.buildSessionFactory(serviceRegistry); return sessionFactory; } catch (HibernateException ex) { Logger.getLogger(HibernateUtil.class.getName()).log(Level.SEVERE, null, ex); throw new ExceptionInInitializerError(ex); } }
protected final Configuration buildConfiguration() { Configuration cfg = new Configuration().setProperties( buildProperties() ); String[] mappingFiles = ConfigurationHelper.toStringArray( mapResources, " ,\n\t\r\f" ); for ( int i = 0; i < mappingFiles.length; i++ ) { cfg.addResource( mappingFiles[i] ); } return cfg; }
protected final Configuration buildConfiguration() { Configuration cfg = new Configuration().setProperties( buildProperties() ); String[] mappingFiles = ConfigurationHelper.toStringArray( mapResources, " ,\n\t\r\f" ); for ( int i = 0; i < mappingFiles.length; i++ ) { cfg.addResource( mappingFiles[i] ); } return cfg; }
protected final Configuration buildConfiguration() { Configuration cfg = new Configuration().setProperties( buildProperties() ); String[] mappingFiles = ConfigurationHelper.toStringArray( mapResources, " ,\n\t\r\f" ); for ( int i = 0; i < mappingFiles.length; i++ ) { cfg.addResource( mappingFiles[i] ); } return cfg; }