Hibernate ORM SchemaUpdate - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM SchemaUpdate class.

This code example shows how to use the following methods: execute, setOutputFile
	@Override 
	public void updateTables(String persistenceUnitName, final Map<String, Object> configOverwrites)
	{ 
		final Ejb3Configuration cfg = new Ejb3Configuration();
		cfg.configure(persistenceUnitName, configOverwrites);
		final SchemaUpdate schemaUpdate = new SchemaUpdate(cfg.getHibernateConfiguration());
		schemaUpdate.setOutputFile("schema.sql");
		schemaUpdate.execute(true, true);
	} 
 
	@Override 
	public void dropTables(String persistenceUnitName, final Map<String, Object> configOverwrites)
	{ 
		final Ejb3Configuration cfg = new Ejb3Configuration();
		cfg.configure(persistenceUnitName, configOverwrites);
		final SchemaExport schemaExport = new SchemaExport(cfg.getHibernateConfiguration());
		schemaExport.setOutputFile("schema.sql");
		schemaExport.drop(true, true);
	} 
 
Full Snippet Info
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: execute, getExceptions
This code example shows how to use the following methods: execute
   * @param script Print the DDL to the console. 
   * @param export 
   */ 
  public void updateSchema(Configuration cfg, boolean script, boolean export) {
    try { 
      SchemaUpdate exp = new SchemaUpdate(cfg);
      exp.execute(script, export);
    } catch (HibernateException ex) {
      log.fatal("Cant't update database schema: " + ex.getMessage(), ex);
      return; 
    } 
  } 
   
  /** 
   * Generates the database schema for the current configured database. 
   *  
   * @param filename Write the schema to the given file. No file output, if 
   *                  null. 
   * @param script Print the DDL to the console. 
   * @param export If true, the script will be executed (export the script to 
Full Snippet Info
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: execute
            cfg.setProperty("hibernate.dialect", HSQLDialect.class.getName());
 
            cfg.setProperty("hibernate.show_sql", "true");
            SessionFactory factory = cfg.buildSessionFactory();
 
            SchemaUpdate update = new SchemaUpdate(cfg);
            update.execute(true, true);
 
            this.factory = factory;
        } 
        return factory;
    } 
 
    protected void tearDown() throws Exception
    { 
            final String[] dropSQLs = cfg.generateDropSchemaScript(new HSQLDialect());
            final Connection connection = getSessionFactory().openSession().connection();
            try { 
                Statement stmt = connection.createStatement();
                for (int i = 0; i < dropSQLs.length; i++) {
Full Snippet Info
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	public SchemaExport getSchema() {
		return new SchemaExport(cfg);
	} 
 
	public SchemaUpdate getSchemaUpdate() {
		return new SchemaUpdate(cfg);
	} 
 
} 
Full Snippet Info
3
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Hibernate ORM SchemaUpdate Methods: