Best code examples for Hibernate ORM SchemaExport class (org.hibernate.tool.hbm2ddl.SchemaExport)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM SchemaExport class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Hibernate ORM SchemaExport examples from Open Source projects
This code example shows how to use the following methods: drop, setOutputFile
	@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);
	} 
 
	@SuppressWarnings("deprecation") 
	@Override 
	public Connection getConnection(EntityManager em)
	{ 
		return ((HibernateEntityManager) em).getSession().connection();
	} 
} 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: create, setDelimiter, setFormat, setOutputFile
    public void afterPropertiesSet() throws Exception {
        this.createSchema();
    } 
 
    protected void exportSchema() { 
        schema.setOutputFile("target/schema.sql");
 
        schema.setFormat(true);
        schema.setDelimiter(";");
        schema.create(true, false);
    } 
 
    protected abstract void createSchema(); 
} 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: create, setDelimiter
    public static void main(String[] args) {
		Ejb3Configuration cfg = new Ejb3Configuration();
		HashMap<String, String> props = new HashMap<String, String>();
		props.put("hibernate.format_sql", "true");
		Ejb3Configuration configured = cfg.configure("slipp.qna", props);
		SchemaExport se = new SchemaExport(configured.getHibernateConfiguration());
		se.setDelimiter(";");
		se.create(true, false);
	} 
} 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: execute, setDelimiter, setOutputFile
   * @param dialect - Database dialect to use 
   */ 
  public void generateSQL(Dialect dialect) {
    configuration.setProperty("hibernate.dialect", dialect.getDialectClass());
 
    SchemaExport export = new SchemaExport(configuration);
    export.setDelimiter(";");
    String outputFile = this.outputDir + File.separator + "ddl_" + dialect.name().toLowerCase() + ".sql";
    export.setOutputFile(outputFile);
    export.execute(false, false, false, !updateSchema);
  } 
 
  /** 
   * Run the schema creation script 
   * 
   * @param jdbcUrl  - the jdbc url for the database in which to run the script 
   * @param dialect- the sql dialect for the database 
   * @param username - the username for the database 
   * @param password - the password to use 
   */ 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: create, setFormat, setOutputFile
public class CreateDataBaseTableByHibernateConfigFile { 
	 
	 
	public static void main(String[] args) {
		Configuration configuration = new Configuration().configure().setNamingStrategy(new ImprovedNamingStrategy());
		SchemaExport export = new SchemaExport(configuration);
		 
		export.setFormat(false);
		export.setOutputFile("src/test/resources/data/h2/create-table-new.sql");
		export.create(true, false);
	} 
	 
} 
Full Snippet Info
5
CodeRank
See Code Examples for Hibernate ORM SchemaExport Methods: