Skip to content

Is it possible to filter by json fields?  #2941

@lewimuchiri

Description

@lewimuchiri

Is it possible to achieve something like this:
select * from book where author->>'name' = 'John Doe';

author is a Postgres column of json type and has a field called 'name'. In JPA, this is represented as follows:

@Entity
@Table(name = "book")
@Include
public class Book {
    @Type(JsonType.class)
    @Column(columnDefinition = "JSON")
    private Author author;
    ...
}

public class Author {
    private String name;
    private String phoneNumber;
    ...
}

The goal is to filter by the fields that are present in the json column.
Is this possible? Otherwise then the question would be whether it's possible to create a custom operator so that I can create ->> for querying the json fields

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions