Example usage for org.hibernate.boot.registry StandardServiceRegistryBuilder DEFAULT_CFG_RESOURCE_NAME

List of usage examples for org.hibernate.boot.registry StandardServiceRegistryBuilder DEFAULT_CFG_RESOURCE_NAME

Introduction

In this page you can find the example usage for org.hibernate.boot.registry StandardServiceRegistryBuilder DEFAULT_CFG_RESOURCE_NAME.

Prototype

String DEFAULT_CFG_RESOURCE_NAME

To view the source code for org.hibernate.boot.registry StandardServiceRegistryBuilder DEFAULT_CFG_RESOURCE_NAME.

Click Source Link

Document

The default resource name for a hibernate configuration xml file.

Usage

From source file:com.quakearts.webapp.hibernate.HibernateHelper.java

License:Open Source License

private static void configureDomain(String domain) throws HibernateException {
    Configuration configuration = new Configuration();
    HelperStore helperStore = new HelperStore();
    helperStore.registryBuilder = new StandardServiceRegistryBuilder()
            .configure(new StringBuilder(domain).append(".")
                    .append(StandardServiceRegistryBuilder.DEFAULT_CFG_RESOURCE_NAME).toString())
            .applySetting(CurrentSessionContextHelper.DOMAIN, domain);

    helperStore.registry = helperStore.registryBuilder.build();
    helperStore.configuration = configuration;
    helperStore.factory = configuration.buildSessionFactory(helperStore.registry);
    store.put(domain, helperStore);/*from w w w  .  j  a  va 2s  . co  m*/
}

From source file:org.balisunrise.daa.hibernate.HDaoManager.java

License:Open Source License

private void setUp() {
    try {//from   w ww. jav a  2  s  . c  om
        builder = new StandardServiceRegistryBuilder();
        String fileName = org.balisunrise.rua.Configuration.classPath(HDaoManager.class)
                + StandardServiceRegistryBuilder.DEFAULT_CFG_RESOURCE_NAME;
        File f = new File(fileName);
        if (f.exists()) {
            builder.configure();
        } else {
            builder.applySettings(HibernateUtil.loadProperties());
        }
        registry = builder.build();
    } catch (Exception ex) {
        // Log the exception. 
        System.err.println("Initial SessionFactory creation failed." + ex);
        throw new ExceptionInInitializerError(ex);
    }
}

From source file:org.balisunrise.tests.hibernate.HibernateUtil.java

License:Open Source License

private static void start() throws Exception {
    builder = new StandardServiceRegistryBuilder();
    String fileName = org.balisunrise.rua.Configuration.classPath(HibernateUtil.class)
            + StandardServiceRegistryBuilder.DEFAULT_CFG_RESOURCE_NAME;
    File f = new File(fileName);
    if (f.exists()) {
        builder.configure();//  w w w. j  a va  2  s.com
    } else {
        builder.applySettings(loadProperties());
    }
}