'How to persist Map with subMap into table?
I have entity with id and map with map inside:
@Data
public class Item {
Long id;
Map<String, Map <String, String> params;
}
how to persist params into single separate table with using hiberante:
id, item_id, string, string, string
1 1 ValueFromOuterMap key1FromInnerMap value1FromInnerMap
2 1 ValueFromOuterMap key2FromInnerMap value2FromInnerMap
Solution 1:[1]
Dig into @ElementCollection and (@CollectionTable, @MapKeyJoinColumn) for adjustments.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Andriy Slobodyanyk |
