Example usage for org.hibernate.tool.hbm2ddl SchemaExport create

List of usage examples for org.hibernate.tool.hbm2ddl SchemaExport create

Introduction

In this page you can find the example usage for org.hibernate.tool.hbm2ddl SchemaExport create.

Prototype

public void create(EnumSet<TargetType> targetTypes, Metadata metadata) 

Source Link

Usage

From source file:GenerateSchema.java

License:BSD License

/**
 * @param args/*from w w  w. j av  a  2s  .c  o  m*/
 */
public static void main(String[] args) {

    Configuration cfg = new Configuration().configure();
    SchemaExport schemaExport = new SchemaExport(cfg);
    schemaExport.setFormat(true);
    schemaExport.setOutputFile("test.sql");
    schemaExport.create(true, false);
}

From source file:Test.java

License:Open Source License

public static void main(String[] args) {
    Configuration cfg = new Configuration().configure();
    SchemaExport export = new SchemaExport(cfg);
    export.create(true, true);
    System.out.println("");
}

From source file:almira.sample.dao.ExportDatabaseSchemaTest.java

License:Apache License

@Test
public void exportDatabaseSchema() {
    PersistenceUnitInfo persistenceUnitInfo = entityManagerFactory.getPersistenceUnitInfo();
    Map<String, Object> jpaPropertyMap = entityManagerFactory.getJpaPropertyMap();

    Configuration configuration = new Ejb3Configuration().configure(persistenceUnitInfo, jpaPropertyMap)
            .getHibernateConfiguration();

    SchemaExport schema = new SchemaExport(configuration);
    schema.setOutputFile("../conf/database/db-001-schema.sql");

    // BUG:// www . j ava  2 s.c  o m
    // https://issues.jboss.org/browse/JBIDE-10558?page=com.atlassian.jira.plugin.system.issuetabpanels:changehistory-tabpanel
    schema.create(true, false);
}

From source file:App.DatabaseSchema.java

public void CreateTables() {
    Configuration cfg = new Configuration();
    cfg.configure("hibernate.cfg.xml");
    SchemaExport se = new SchemaExport(cfg);

    se.create(true, true);

}

From source file:banco.GeraBanco.java

public static void main(String[] args) {
    try {/* w w w. j  a va2s  .co  m*/
        Configuration cfg = new Configuration();
        cfg.configure();
        SchemaExport se = new SchemaExport(cfg);
        se.create(true, true);
        JOptionPane.showMessageDialog(null, "O Banco de Dados foi gerado com sucesso!", "Fafica .:. Alerta",
                JOptionPane.INFORMATION_MESSAGE);
    } catch (HibernateException | HeadlessException e) {
        System.out.println(e);
        JOptionPane.showMessageDialog(null, "Erro ao Gerar a Base de Dados!", "Fafica .:. Alerta",
                JOptionPane.ERROR_MESSAGE);
    }
}

From source file:br.com.hrstatus.dao.CreateTables.java

License:Open Source License

public static void main(String[] args) {
    final AnnotationConfiguration cfg = new AnnotationConfiguration();

    cfg.addAnnotatedClass(br.com.hrstatus.model.Users.class);
    cfg.addAnnotatedClass(br.com.hrstatus.model.Servidores.class);

    final SchemaExport se = new SchemaExport(cfg);
    se.create(true, true);
}

From source file:br.com.hslife.catu.db.GerarTabelas.java

License:Open Source License

public static void geraTabelas() {
    Configuration cfg = new AnnotationConfiguration();
    cfg.configure("br/com/hslife/catu/db/hibernate.cfg.xml");

    SchemaExport se = new SchemaExport(cfg);
    se.create(true, true);
}

From source file:br.com.hslife.clickafacil.hibernate.GeraSQL.java

License:Open Source License

public static void main(String args[]) {
    Configuration cfg = new AnnotationConfiguration();
    cfg.configure("br/com/hslife/clickafacil/config/hibernate.cfg.xml");
    SchemaExport se = new SchemaExport(cfg);
    se.create(true, true);
}

From source file:br.com.hslife.imobiliaria.db.GerarTabelas.java

License:Open Source License

public static void geraTabelas() {
    Configuration cfg = new AnnotationConfiguration();
    cfg.configure("br/com/hslife/imobiliaria/db/hibernate.cfg.xml");

    SchemaExport se = new SchemaExport(cfg);
    se.create(true, true);
}

From source file:br.com.hslife.sirce.hibernate.GerarTabelas.java

License:Open Source License

public static void geraTabelas() {
    Configuration cfg = new AnnotationConfiguration();
    cfg.configure("br/com/hslife/sirce/hibernate/hibernate.cfg.xml");

    SchemaExport se = new SchemaExport(cfg);
    se.create(true, true);
}