@@ -1289,7 +1289,11 @@ private Statement buildStatement(
1289
1289
builder .bind (fieldName ).toTimestampArray (null );
1290
1290
break ;
1291
1291
case JSON :
1292
- builder .bind (fieldName ).toJsonArray (null );
1292
+ if (elementType .getTypeAnnotation () == TypeAnnotationCode .PG_JSONB ) {
1293
+ builder .bind (fieldName ).toPgJsonbArray (null );
1294
+ } else {
1295
+ builder .bind (fieldName ).toJsonArray (null );
1296
+ }
1293
1297
break ;
1294
1298
case STRUCT :
1295
1299
case TYPE_CODE_UNSPECIFIED :
@@ -1331,7 +1335,11 @@ private Statement buildStatement(
1331
1335
builder .bind (fieldName ).to ((com .google .cloud .Timestamp ) null );
1332
1336
break ;
1333
1337
case JSON :
1334
- builder .bind (fieldName ).to (Value .json (null ));
1338
+ if (fieldType .getTypeAnnotation () == TypeAnnotationCode .PG_JSONB ) {
1339
+ builder .bind (fieldName ).to (Value .pgJsonb (null ));
1340
+ } else {
1341
+ builder .bind (fieldName ).to (Value .json (null ));
1342
+ }
1335
1343
break ;
1336
1344
case TYPE_CODE_UNSPECIFIED :
1337
1345
case UNRECOGNIZED :
@@ -1416,12 +1424,21 @@ private Statement buildStatement(
1416
1424
com .google .cloud .spanner .Type .timestamp (), value .getListValue ()));
1417
1425
break ;
1418
1426
case JSON :
1419
- builder
1420
- .bind (fieldName )
1421
- .toJsonArray (
1422
- (Iterable <String >)
1423
- GrpcStruct .decodeArrayValue (
1424
- com .google .cloud .spanner .Type .json (), value .getListValue ()));
1427
+ if (elementType .getTypeAnnotation () == TypeAnnotationCode .PG_JSONB ) {
1428
+ builder
1429
+ .bind (fieldName )
1430
+ .toPgJsonbArray (
1431
+ (Iterable <String >)
1432
+ GrpcStruct .decodeArrayValue (
1433
+ com .google .cloud .spanner .Type .pgJsonb (), value .getListValue ()));
1434
+ } else {
1435
+ builder
1436
+ .bind (fieldName )
1437
+ .toJsonArray (
1438
+ (Iterable <String >)
1439
+ GrpcStruct .decodeArrayValue (
1440
+ com .google .cloud .spanner .Type .json (), value .getListValue ()));
1441
+ }
1425
1442
break ;
1426
1443
case STRUCT :
1427
1444
case TYPE_CODE_UNSPECIFIED :
@@ -1464,7 +1481,11 @@ private Statement buildStatement(
1464
1481
.to (com .google .cloud .Timestamp .parseTimestamp (value .getStringValue ()));
1465
1482
break ;
1466
1483
case JSON :
1467
- builder .bind (fieldName ).to (Value .json (value .getStringValue ()));
1484
+ if (fieldType .getTypeAnnotation () == TypeAnnotationCode .PG_JSONB ) {
1485
+ builder .bind (fieldName ).to (Value .pgJsonb (value .getStringValue ()));
1486
+ } else {
1487
+ builder .bind (fieldName ).to (Value .json (value .getStringValue ()));
1488
+ }
1468
1489
break ;
1469
1490
case TYPE_CODE_UNSPECIFIED :
1470
1491
case UNRECOGNIZED :
0 commit comments