Java Code Examples for org.hibernate.cfg.Configuration#getProperties()

The following examples show how to use org.hibernate.cfg.Configuration#getProperties() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfigBean.java    From sailfish-core with Apache License 2.0 6 votes vote down vote up
public boolean equals(Configuration configuration) {

			Properties prop = configuration.getProperties();

			if (!driverClass.equals(prop.getProperty(AvailableSettings.DRIVER))) {
				return false;
			}
			if (!dialect.equals(prop.getProperty(AvailableSettings.DIALECT))) {
				return false;
			}
			if (!preferredTestQuery.equals(prop.getProperty(PREFFERED_TEST_QUERY))) {
				return false;
			}
			if (!userName.equals(prop.getProperty(AvailableSettings.USER))) {
				return false;
			}
			if (!password.equals(prop.getProperty(AvailableSettings.PASS))) {
				return false;
			}
			if (!createProtocolUrl(this).equals(prop.getProperty(AvailableSettings.URL))) {
				return false;
			}

			return true;
		}
 
Example 2
Source File: OlatTestCase.java    From olat with Apache License 2.0 6 votes vote down vote up
@Before
public void printBanner() {
    final OLATLocalSessionFactoryBean bean = (OLATLocalSessionFactoryBean) CoreSpringFactory.getBean(OLATLocalSessionFactoryBean.class);
    final Configuration configuration = bean.getConfiguration();

    final Properties properties = configuration.getProperties();

    final String[] propsOfInterest = new String[] { "hibernate.connection.driver_class", "hibernate.connection.provider_class", "hibernate.connection.url",
            "hibernate.connection.username", };

    final String connectionURL = (String) properties.get("hibernate.connection.url");
    hsqlDBConfigured = connectionURL != null && connectionURL.toLowerCase().indexOf("hsqldb") > 0;

    System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
    for (int i = 0; i < propsOfInterest.length; i++) {
        System.out.println("++" + propsOfInterest[i] + " -> " + properties.getProperty(propsOfInterest[i]));
    }

    System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
    printOlatLocalProperties();
    System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
    System.out.println("+ OLAT configuration initialized, starting now with junit tests +");
    System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");

}
 
Example 3
Source File: OlatTestCase.java    From olat with Apache License 2.0 6 votes vote down vote up
@Before
public void printBanner() {
    final OLATLocalSessionFactoryBean bean = (OLATLocalSessionFactoryBean) CoreSpringFactory.getBean(OLATLocalSessionFactoryBean.class);
    final Configuration configuration = bean.getConfiguration();

    final Properties properties = configuration.getProperties();

    final String[] propsOfInterest = new String[] { "hibernate.connection.driver_class", "hibernate.connection.provider_class", "hibernate.connection.url",
            "hibernate.connection.username", };

    final String connectionURL = (String) properties.get("hibernate.connection.url");
    hsqlDBConfigured = connectionURL != null && connectionURL.toLowerCase().indexOf("hsqldb") > 0;

    System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
    for (int i = 0; i < propsOfInterest.length; i++) {
        System.out.println("++" + propsOfInterest[i] + " -> " + properties.getProperty(propsOfInterest[i]));
    }

    System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
    printOlatLocalProperties();
    System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
    System.out.println("+ OLAT configuration initialized, starting now with junit tests +");
    System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");

}
 
Example 4
Source File: ConfigBean.java    From sailfish-core with Apache License 2.0 5 votes vote down vote up
public void applyConfig(Configuration configuration) {

			Properties prop = configuration.getProperties();

			try {
    			String url = prop.getProperty(AvailableSettings.URL, "");

    			URI full = new URI(url);
				URI uri = new URI(full.getSchemeSpecificPart());
				setProtocol(full.getScheme());
				setSubProtocol(uri.getScheme());
				setHost(uri.getHost());
				int intPort = uri.getPort();
                port = intPort == -1 ? "" : String.valueOf(intPort);
				path = uri.getPath().replace("/", "");
				query = uri.getQuery();
			} catch (URISyntaxException e) {
				logger.error("Could not parse hibernate url.", e);
			}

			driverClass = prop.getProperty(AvailableSettings.DRIVER);
			dialect = prop.getProperty(AvailableSettings.DIALECT);
			preferredTestQuery = prop.getProperty(PREFFERED_TEST_QUERY, "SELECT 1;");

			userName = prop.getProperty(AvailableSettings.USER, "sailfish");
			password = prop.getProperty(AvailableSettings.PASS, "999");

		}
 
Example 5
Source File: SchemaUpdate.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public SchemaUpdate(Configuration cfg) throws HibernateException {
	this(cfg, cfg.getProperties());
}
 
Example 6
Source File: SchemaExport.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Create a schema exporter for the given Configuration
 */
public SchemaExport(Configuration cfg) throws HibernateException {
	this( cfg, cfg.getProperties() );
}
 
Example 7
Source File: SchemaUpdate.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public SchemaUpdate(Configuration cfg) throws HibernateException {
	this( cfg, cfg.getProperties() );
}
 
Example 8
Source File: SchemaValidator.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public SchemaValidator(Configuration cfg) throws HibernateException {
	this( cfg, cfg.getProperties() );
}