Uploaded image for project: 'Hibernate ODM'
  1. Hibernate ODM
  2. HIBERNATE-63

Implementing simple array function filter

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      After we finished BsonArray embedding, a natural next step is to implement some basic array SQL function to use in WHERE clause, including (see https://docs.jboss.org/hibernate/orm/6.6/userguide/html_single/Hibernate_User_Guide.html#hql-functions-arrays):

      • array_contains
      • array_includes

      So for the following HQL:

      select * from Book where array_contains(tags, "classic")

       

      for the following Book entity:

      @Entity
      @Table(name = "books")
      class Book {       
          @Id int id;
          String title;
          List<String> tags;
      } 

       

      The difference between the two functions is the former test a single value (like the example above), whereas the latter tests on another array to see whether it is a subset.

       

      There are many array SQL functions but the above two are the most basic ones and should satisfy lots of requirements.

       

      Hibernate extension points:

      PoC PR:

            Assignee:
            Unassigned Unassigned
            Reporter:
            nathan.xu@mongodb.com Nathan Xu
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: