Class PJson<R>

  • Type Parameters:
    R - the root query bean type

    public class PJson<R>
    extends TQPropertyBase<R>
    JSON document type.

    Type that is JSON content mapped to database types such as Postgres JSON/JSONB and otherwise Varchar,Clob and Blob.

    The expressions on this type are valid of Postgres and Oracle.

    The path can reference a nested property in the JSON document using dot notation - for example "documentMeta.score" where "score" is an embedded attribute of "documentMeta"

    • Constructor Detail

      • PJson

        public PJson​(String name,
                     R root)
        Construct with a property name and root instance.
        Parameters:
        name - property name
        root - the root query bean instance
      • PJson

        public PJson​(String name,
                     R root,
                     String prefix)
        Construct with additional path prefix.
    • Method Detail

      • jsonExists

        public R jsonExists​(String path)
        Path exists - for the given path in a JSON document.
        
        
           new QSimpleDoc()
            .content.jsonExists("meta.title")
            .findList();
        
         
        Parameters:
        path - the nested path in the JSON document in dot notation
      • jsonNotExists

        public R jsonNotExists​(String path)
        Path does not exist - for the given path in a JSON document.
        
        
           new QSimpleDoc()
            .content.jsonNotExists("meta.title")
            .findList();
        
         
        Parameters:
        path - the nested path in the JSON document in dot notation
      • jsonEqualTo

        public R jsonEqualTo​(String path,
                             Object value)
        Value at the given JSON path is equal to the given value.
        
        
           new QSimpleDoc()
            .content.jsonEqualTo("title", "Rob JSON in the DB")
            .findList();
        
         
        
        
           new QSimpleDoc()
            .content.jsonEqualTo("path.other", 34)
            .findList();
        
         
        Parameters:
        path - the dot notation path in the JSON document
        value - the equal to bind value
      • jsonNotEqualTo

        public R jsonNotEqualTo​(String path,
                                Object value)
        Not Equal to - for the given path in a JSON document.
        Parameters:
        path - the nested path in the JSON document in dot notation
        value - the value used to test equality against the document path's value
      • jsonGreaterThan

        public R jsonGreaterThan​(String path,
                                 Object value)
        Greater than - for the given path in a JSON document.
        Parameters:
        path - the nested path in the JSON document in dot notation
        value - the value used to test against the document path's value
      • jsonGreaterOrEqual

        public R jsonGreaterOrEqual​(String path,
                                    Object value)
        Greater than or equal to - for the given path in a JSON document.
        Parameters:
        path - the nested path in the JSON document in dot notation
        value - the value used to test against the document path's value
      • jsonLessThan

        public R jsonLessThan​(String path,
                              Object value)
        Less than - for the given path in a JSON document.
        Parameters:
        path - the nested path in the JSON document in dot notation
        value - the value used to test against the document path's value
      • jsonLessOrEqualTo

        public R jsonLessOrEqualTo​(String path,
                                   Object value)
        Less than or equal to - for the given path in a JSON document.
        Parameters:
        path - the nested path in the JSON document in dot notation
        value - the value used to test against the document path's value