Example usage for org.hibernate.cfg Environment getProperties

List of usage examples for org.hibernate.cfg Environment getProperties

Introduction

In this page you can find the example usage for org.hibernate.cfg Environment getProperties.

Prototype

public static Properties getProperties() 

Source Link

Document

Return System properties, extended by any properties specified in hibernate.properties.

Usage

From source file:com.lg.hibernate.guide.test.BaseEntityManagerFunctionalTestCase.java

License:LGPL

protected Map getConfig() {
    Map<Object, Object> config = Environment.getProperties();
    ArrayList<Class> classes = new ArrayList<Class>();

    classes.addAll(Arrays.asList(getAnnotatedClasses()));
    config.put(AvailableSettings.LOADED_CLASSES, classes);
    for (Map.Entry<Class, String> entry : getCachedClasses().entrySet()) {
        config.put(AvailableSettings.CLASS_CACHE_PREFIX + "." + entry.getKey().getName(), entry.getValue());
    }//from   w  w  w. j  ava 2  s. c o m
    for (Map.Entry<String, String> entry : getCachedCollections().entrySet()) {
        config.put(AvailableSettings.COLLECTION_CACHE_PREFIX + "." + entry.getKey(), entry.getValue());
    }
    if (getEjb3DD().length > 0) {
        ArrayList<String> dds = new ArrayList<String>();
        dds.addAll(Arrays.asList(getEjb3DD()));
        config.put(AvailableSettings.XML_FILE_NAMES, dds);
    }

    addConfigOptions(config);
    return config;
}

From source file:com.stone.core.db.service.orm.ServiceRegistryBuilder.java

License:Open Source License

public static StandardServiceRegistryImpl buildServiceRegistry() {
    return buildServiceRegistry(Environment.getProperties());
}

From source file:net.lshift.hibernate.migrations.SQLStringHelpers.java

License:Apache License

/**
 * Generates an identity column string//from w ww  .ja  va2 s. com
 * @throws UnsupportedOperationException If the underlying dialect does not support identity columns*
*/
public static String generateIdentityColumnString(Dialect dialect, Column col) {

    if (!dialect.supportsIdentityColumns()) {
        String dialectName = Environment.getProperties().getProperty(Environment.DIALECT);
        throw new UnsupportedOperationException(dialectName + " does not support identity columns");
    }

    StringBuilder buffer = new StringBuilder();

    buffer.append(col.getQuotedName(dialect)).append(" ");

    // to support dialects that have their own identity data type
    if (dialect.hasDataTypeInIdentityColumn()) {
        buffer.append(getTypeName(dialect, col));
    }
    buffer.append(' ').append(dialect.getIdentityColumnString(col.getSqlTypeCode()));

    return buffer.toString();
}

From source file:org.infinispan.test.hibernate.cache.commons.InfinispanRegionFactoryTestCase.java

License:LGPL

private static Properties createProperties() {
    final Properties properties = new Properties();
    // If configured in the environment, add configuration file name to properties.
    final String cfgFileName = (String) Environment.getProperties().get(INFINISPAN_CONFIG_RESOURCE_PROP);
    if (cfgFileName != null) {
        properties.put(INFINISPAN_CONFIG_RESOURCE_PROP, cfgFileName);
    }// w w  w . j a v  a2s . c o  m
    return properties;
}

From source file:org.inwiss.platform.persistence.util.BinaryBlobType.java

License:Apache License

/**
 * Creates new instance of BinaryBlobType
 *///from  ww w . j a v a2  s . co  m
public BinaryBlobType() {
    isBlob = "blob".equalsIgnoreCase(
            PropertiesHelper.getString("hibernate.binary_or_blob", Environment.getProperties(), "binary"));
}

From source file:podd.util.db.impl.HibernateSessionFactoryImpl.java

License:Open Source License

public HibernateSessionFactoryImpl(String configurationFileURL) {
    if (_DEBUG) {
        LOG.debug("HibernateSessionFactoryImpl constructor - loading config");
    }//  ww  w  .  j a  v a 2  s.  co  m
    map = new ThreadLocal<Session>();
    final Configuration configuration = new Configuration().setProperties(Environment.getProperties());
    factory = configuration.configure(configurationFileURL).buildSessionFactory();
    if (_DEBUG) {
        LOG.debug("HibernateSessionFactoryImpl constructor - end");
    }
}