Eric Stadtherr commented on Bug HHH-4947

This bug has caused pain for my project as well. Hibernate seems to be treating a null-valued mapping in a basic element collection (i.e. a Map<String,String>) as no mapping at all, which is obviously incorrect.

Some of the discussions in other related issues (such as HHH-772, which is marked as closed:fixed for some reason even though the bug is still very much present in Hibernate 4.1.9) have suggested that having null values in Map collections is invalid, and therefore this isn't a bug. Having a null value for a map is perfectly valid, and is fully supported by the Java Map types. Semantically, the presence of a value with a null value association is much different than the value being completely absent from the map.

The Hibernate developers (or some vocal subset of them) might not understand why an application designer might choose an object model that is structured this way, but that is irrelevant. Hibernate's purpose as an ORM tool is to map an object model to a relational schema, not to make subjective determinations about an application's object model. In this case, the mapping can be fully supported by NULL values in the relational table, so Hibernate should not get in the way of capturing the persistent state of the application's model.

Please let me know if there's anything else I can provide as far as support for getting this bug finally fixed.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira