This will fail if the actual tables look like this:
INSERT INTO authors(author_id, name) VALUES ('Author1', null);
INSERT INTO books(book_id, author_id, name) VALUES ('Book1' 'Author1', 'Harry Potter');
INSERT INTO books(book_id, author_id, name) VALUES ('Book2' 'Author1', 'Harry Potter returns');
It would not fail, if instead of a map, I would be using an actual property. This is not possible for my use case however. It would also work, if the property could not be null, then SimpleFlatMapper seems to correctly flatten the object. I tried to exclude null values from the map but the documentation only mentions "addKeys" for this and adding the author name as a key simply turned the whole map into null, even if there are other properties like a author email for example, that could be mapped and is not nullable. Changing the MapPropertyType also did not work. If there would be a way to simply stop SimpleFlatMapper from adding null Values to the map, the problem would be solved as well but that should probably be configurable and the map should still work for other properties that are not null and can be added to the map.
Hi, first things first: Thank you for creating such a wonderful piece of software :)
I am having trouble when mapping columns that are nullable to a Map. Let's take this Query as an example:
Now let's assume the objects look like this:
I would then do something like this:
This will fail if the actual tables look like this:
It would not fail, if instead of a map, I would be using an actual property. This is not possible for my use case however. It would also work, if the property could not be null, then SimpleFlatMapper seems to correctly flatten the object. I tried to exclude null values from the map but the documentation only mentions "addKeys" for this and adding the author name as a key simply turned the whole map into null, even if there are other properties like a author email for example, that could be mapped and is not nullable. Changing the MapPropertyType also did not work. If there would be a way to simply stop SimpleFlatMapper from adding null Values to the map, the problem would be solved as well but that should probably be configurable and the map should still work for other properties that are not null and can be added to the map.
Best Regards