Configuration object and org.hibernate.cfg.Environment have lots of methods like
..... (lots of other ones)
which all manipulate java.util.Properties as it was only a Map (calls to putAll methods with properties as argument, calls to entrySet(), etc). This is very wrong, as a java.util.Properties is more than a map. Calling map related method only access the first level of the properties. It does not take into account the default value stored in a delegate Properties.
Properties generic = new Properties();
Properties specific = new Properties(generic);
System.out.println(specific.getProperty("hibernate.connection.url")); // printout jdbcostgresql://localhost/mydatabase
Configuration c = new Configuration().configure(urlWithMyMappings).addProperties(specific);
A unit test should be easy to derivate from this example code + existing hibernate unit tests (if those exist)
Now, when you use that configuration, you will notice Hibernate does not see the hibernate.connection.driver_class and hibernate.connection.url properties, poping out exceptions at will, while it's not documented anywhere to not use the form new Properties(defaultProperties).
Either don't use the map/collection related methods of java.util.Properties, instead use the propertyNames() Enumeration when the content of a Properties object has to be analyzed! (Remove all calls like properties.putAll(), properties.keySet(), properties.entrySet())
Either change the Configuration interface to take a Map and not a java.util.Properties as all code in Configuration and related classes consider it a s a simple Map
Does not matter (Hibernate 3, even cvs has the bug)
In an effort to clean up, in bulk, tickets that are most likely out of date, we're transitioning all ORM 3 tickets to an "Awaiting Test Case" state. Please see http://in.relation.to/Bloggers/HibernateORMJIRAPoliciesAndCleanUpTactics for more information.
If this is still a legitimate bug in ORM 4, please provide either a test case that reproduces it or enough detail (entities, mappings, snippets, etc.) to show that it still fails on 4. If nothing is received within 3 months or so, we'll be automatically closing them.
This bug is still valid for hibernate-core-4.3.5.Final.jar: Method Configuration.buildSessionFactory(ServiceRegistry) calls copy.putAll(properties) and this.properties may include defaults, since they are publicly settable in setProperties. So the SessionFactoryImpl may still get incomplete properties.
Thanks for the response
Rejecting this. 4.x (and earlier) are no longer maintained. And in 5.0 I moved away from Properties to a Map for holding config setting values. Hibernate always operated that way anyway because it allowed non-String values.