Issues

Select view

Select search mode

 
35 of 35

Map of @Embeddables has values loaded only when != null

Rejected

Description

Hello,

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.

Details

Assignee

Reporter

Priority

Created May 4, 2017 at 6:15 PM
Updated August 16, 2017 at 9:57 PM
Resolved August 16, 2017 at 9:57 PM

Activity

Show:

Former user August 16, 2017 at 9:57 PM

Rejecting because this is expected behavior.

Former user July 25, 2017 at 7:41 PM

Former user July 22, 2017 at 9:09 PM

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.

Former user July 21, 2017 at 6:06 AM
Edited

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.

Petar Tahchiev May 10, 2017 at 2:03 PM

It could be database-specific - under mysql the NULL values are stored. I haven't checked hsql though.

Loading...