here's my setup:
where LocalizedValue is:
I create one Product assign two values for it's description (first entry is <Locale.ENGLISH, null> and the second is <Locale.GERMAN, "test">). Then I select the product from the database, and inspect the description map - the result is it only has 1 element in the map - <Locale.GERMAN, "test"> one.
I will create a test project soon.
It could be database-specific - under mysql the NULL values are stored. I haven't checked hsql though.
This is expected behavior. Hibernate should not be writing null elements to the collection table. If Hibernate happens to read a null element, it should be ignored.
I just fixed a bug () with Set collections, where null elements were (incorrectly) being persisted.
Currently, there is an inconsistency with empty composite values. I am in the process of fixing that ().
This behavior does not depend on dialect. If Hibernate is adding a null element to a collection table, then that is a bug.
If you are adding an empty string as a collection element, then Hibernate should persist the empty string in the collection table. If your database automatically converts empty strings to null, then you would end up with null in your collection table, and Hibernate would end up ignoring the collection element when it is read.
Here is a comment that explains the rationale for not persisting a null collection element: https://hibernate.atlassian.net/browse/HHH-772?focusedCommentId=41974&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-41974
Rejecting because this is expected behavior.