Example usage for org.hibernate.cfg Configuration addProperties

List of usage examples for org.hibernate.cfg Configuration addProperties

Introduction

In this page you can find the example usage for org.hibernate.cfg Configuration addProperties.

Prototype

public Configuration addProperties(Properties properties) 

Source Link

Document

Add the given properties to ours.

Usage

From source file:uk.co.modularaudio.util.hibernate.generator.GeneratorHelper.java

License:Open Source License

/**
 * Method to configure necessary hibernate properties and generate DDL for a supplied configuration
 * @param dialectName Which hibernate dialect should be used
 * @param destinationDirectory The output directory
 * @param outputFileName The output filename
 * @param configuration The hibernate configuration setup with the appropriate schema objects
 *//*from w  w  w .  j ava2 s .c  o m*/
private void configureAndGenerate(final String dialectName, final String destinationDirectory,
        final String outputFileName, final Configuration configuration) {
    final Properties dialect = new Properties();
    dialect.setProperty("hibernate.dialect", dialectName);
    configuration.addProperties(dialect);

    final SchemaExport se = new SchemaExport(configuration);
    se.setOutputFile(destinationDirectory + outputFileName);
    se.setDelimiter(";\n");
    se.create(true, false);
}