File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
ebean-test/src/test/java/org/tests/json Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 11package org .tests .json ;
22
33import io .ebean .DB ;
4+ import io .ebean .annotation .Platform ;
45import io .ebean .test .LoggedSql ;
56import org .junit .jupiter .api .Test ;
67import org .tests .model .json .EBasicJsonBString ;
@@ -38,10 +39,21 @@ void test() {
3839
3940
4041 // change content only
41- found .content ("{\" mykey\" : 95}" );
42+ found .content ("{\" mykey\" : 95, \" other \" : \" AI \" }" );
4243 DB .save (found );
4344 sql = LoggedSql .stop ();
4445 assertThat (sql .get (0 )).contains ("update ebasic_json_bstring set content=?, version=? where id=? and version=?" );
4546
47+
48+ if (DB .getDefault ().platform () == Platform .POSTGRES ) {
49+ List <EBasicJsonBString > result = DB .find (EBasicJsonBString .class )
50+ .where ()
51+ .raw ("content -> 'other' ?? ?" , "AI" )
52+ .raw ("jsonb_exists(content -> 'other', ?)" , "AI" )
53+ .raw ("jsonb_path_exists(content, '$.other ? (@ >= $param)', '{\" param\" :\" AI\" }')" )
54+ .findList ();
55+
56+ assertThat (result ).hasSize (1 );
57+ }
4658 }
4759}
You can’t perform that action at this time.
0 commit comments