Search in sources :

Example 1 with MidPointNamingStrategy

use of com.evolveum.midpoint.repo.sql.util.MidPointNamingStrategy in project midpoint by Evolveum.

the class SpringApplicationContextTest method createSQLSchema.

private void createSQLSchema(String fileName, String dialect) throws Exception {
    org.hibernate.cfg.Configuration configuration = new Configuration();
    configuration.setNamingStrategy(new MidPointNamingStrategy());
    configuration.setProperties(sessionFactory.getHibernateProperties());
    sessionFactory.getHibernateProperties().setProperty("hibernate.dialect", dialect);
    System.out.println("Dialect: " + sessionFactory.getHibernateProperties().getProperty("hibernate.dialect"));
    addAnnotatedClasses("com.evolveum.midpoint.repo.sql.data.common", configuration);
    addAnnotatedClasses("com.evolveum.midpoint.repo.sql.data.common.container", configuration);
    addAnnotatedClasses("com.evolveum.midpoint.repo.sql.data.common.any", configuration);
    addAnnotatedClasses("com.evolveum.midpoint.repo.sql.data.common.embedded", configuration);
    addAnnotatedClasses("com.evolveum.midpoint.repo.sql.data.common.enums", configuration);
    addAnnotatedClasses("com.evolveum.midpoint.repo.sql.data.common.id", configuration);
    addAnnotatedClasses("com.evolveum.midpoint.repo.sql.data.common.other", configuration);
    addAnnotatedClasses("com.evolveum.midpoint.repo.sql.data.common.type", configuration);
    addAnnotatedClasses("com.evolveum.midpoint.repo.sql.data.audit", configuration);
    //        addAnnotatedClasses("com.evolveum.midpoint.repo.sql.data.poc", configuration);
    configuration.addPackage("com.evolveum.midpoint.repo.sql.type");
    SchemaExport export = new SchemaExport(configuration);
    export.setOutputFile(fileName);
    export.setDelimiter(";");
    export.execute(true, false, false, true);
}
Also used : ContextConfiguration(org.springframework.test.context.ContextConfiguration) Configuration(org.hibernate.cfg.Configuration) Configuration(org.hibernate.cfg.Configuration) MidPointNamingStrategy(com.evolveum.midpoint.repo.sql.util.MidPointNamingStrategy) SchemaExport(org.hibernate.tool.hbm2ddl.SchemaExport)

Aggregations

MidPointNamingStrategy (com.evolveum.midpoint.repo.sql.util.MidPointNamingStrategy)1 Configuration (org.hibernate.cfg.Configuration)1 SchemaExport (org.hibernate.tool.hbm2ddl.SchemaExport)1 ContextConfiguration (org.springframework.test.context.ContextConfiguration)1