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

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