org.hibernate.cfg.Configuration should obey standard java.util.Properties overwrite rules

Description

Standard Java properties operate under the principal of "first come first served". Once a property has a value it is not changed by a later attempt.

The method org.hibernate.cfg.Configuration.addProperties(Element parent) should read

private void addProperties(Element parent) {
Iterator iter = parent.elementIterator( "property" );
while ( iter.hasNext() ) {
Element node = (Element) iter.next();
String name = node.attributeValue( "name" );
String value = node.getText().trim();
log.debug( name + "=" + value );
if (properties.containsKey(name)
continue;
properties.setProperty( name, value );
if ( !name.startsWith( "hibernate" ) ) {
properties.setProperty( "hibernate." + name, value );
}
}
Environment.verifyProperties( properties );
}

Environment

All environments

Activity

Show:
Emmanuel Bernard
April 19, 2006, 3:57 AM

We cannot break all the Hibernate applications outthere. Plus it allows programmatic overriding over file configuration

Steve Ebersole
March 21, 2011, 6:59 PM

Closing stale resolved issues

Assignee

Unassigned

Reporter

Ben Wolfe

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Minor
Configure