4444import java .sql .Clob ;
4545import java .util .List ;
4646import java .util .Map ;
47+ import java .util .Set ;
4748
4849import static org .hamcrest .MatcherAssert .assertThat ;
4950import static org .hamcrest .Matchers .equalTo ;
@@ -81,6 +82,7 @@ public Jackson() {
8182 private final Map <StringNode , StringNode > objectMap ;
8283 private final List <StringNode > list ;
8384 private final String json ;
85+ Map <String , Map <String , List <Set <Long >>>> complexMap ;
8486
8587 protected JsonMappingTests (boolean supportsObjectMapKey ) {
8688 this .stringMap = Map .of ( "name" , "ABC" );
@@ -90,13 +92,14 @@ protected JsonMappingTests(boolean supportsObjectMapKey) {
9092 ) : null ;
9193 this .list = List .of ( new StringNode ( "ABC" ) );
9294 this .json = "{\" name\" :\" abc\" }" ;
95+ this .complexMap = Map .of ( "name" , Map .of ( "inner" , List .of ( Set .of ( 10L ), Set .of ( 20L ) ) ) );
9396 }
9497
9598 @ BeforeEach
9699 public void setup (SessionFactoryScope scope ) {
97100 scope .inTransaction (
98101 (session ) -> {
99- session .persist ( new EntityWithJson ( 1 , stringMap , objectMap , list , json ) );
102+ session .persist ( new EntityWithJson ( 1 , stringMap , objectMap , list , json , complexMap ) );
100103 }
101104 );
102105 }
@@ -153,7 +156,7 @@ public void verifyReadWorks(SessionFactoryScope scope) {
153156 public void verifyMergeWorks (SessionFactoryScope scope ) {
154157 scope .inTransaction (
155158 (session ) -> {
156- session .merge ( new EntityWithJson ( 2 , null , null , null , null ) );
159+ session .merge ( new EntityWithJson ( 2 , null , null , null , null , null ) );
157160 }
158161 );
159162
@@ -166,6 +169,7 @@ public void verifyMergeWorks(SessionFactoryScope scope) {
166169 assertThat ( entityWithJson .jsonString , is ( nullValue () ) );
167170 assertThat ( entityWithJson .jsonNode , is ( nullValue () ) );
168171 assertThat ( entityWithJson .jsonValue , is ( nullValue () ) );
172+ assertThat ( entityWithJson .complexMap , is ( nullValue () ) );
169173 }
170174 );
171175 }
@@ -270,6 +274,7 @@ public void verifyCriteriaUpdateQueryWorks(SessionFactoryScope scope) {
270274 assertThat ( entityWithJson .stringMap , is ( newMap ) );
271275 assertThat ( entityWithJson .list , is ( newList ) );
272276 assertThat ( entityWithJson .jsonString .replaceAll ( "\\ s" , "" ), is ( newJson ) );
277+ assertThat ( entityWithJson .complexMap , is ( complexMap ) );
273278 } );
274279 }
275280
@@ -299,6 +304,9 @@ public static class EntityWithJson {
299304 @ JdbcTypeCode ( SqlTypes .JSON )
300305 private JsonValue jsonValue ;
301306
307+ @ JdbcTypeCode ( SqlTypes .JSON )
308+ private Map <String , Map <String , List <Set <Long >>>> complexMap ;
309+
302310 public EntityWithJson () {
303311 }
304312
@@ -307,12 +315,14 @@ public EntityWithJson(
307315 Map <String , String > stringMap ,
308316 Map <StringNode , StringNode > objectMap ,
309317 List <StringNode > list ,
310- String jsonString ) {
318+ String jsonString ,
319+ Map <String , Map <String , List <Set <Long >>>> complexMap ) {
311320 this .id = id ;
312321 this .stringMap = stringMap ;
313322 this .objectMap = objectMap ;
314323 this .list = list ;
315324 this .jsonString = jsonString ;
325+ this .complexMap = complexMap ;
316326 }
317327 }
318328
0 commit comments