Limit/skip aggregate stages MQL translation

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Usually, limit/skip feature goes hand in hand with sorting. Notice that we have two kinds of skip/limit info sources:

      • HQL/Criteria
      List<Call> calls1 = entityManager.createQuery(
      	"select c " +
      	"from Call c " +
      	"join c.phone p " +
      	"order by p.number " +
      	"limit 50",
      	Call.class)
      .getResultList();
      
      // same thing
      List<Call> calls2 = entityManager.createQuery(
      	"select c " +
      	"from Call c " +
      	"join c.phone p " +
      	"order by p.number " +
      	"fetch first 50 rows only",
      	Call.class)
      .getResultList();
      • QueryOptions's `setFirstResult()` and `setMaxResults()` methods
      List<Person> persons = entityManager.createQuery("select p " +
              "from Person p " + 
              "order by p.age ", Person.class).
            .setFirstResult(20)
            .setMaxResults(50)
            .getResultList();

      We need to cover both cases.

      It is possible that we'll need to use the jdbcParameterBindings parameter of the SelectMqlTranslator.translate method when working on this ticket, see Nathan's comment https://github.com/mongodb/mongo-hibernate/pull/81#discussion_r2041131928 for more details.
       

      Addressing the source code notes tagged with TODO-HIBERNATE-70 is in scope of this ticket.

            Assignee:
            Nathan Xu
            Reporter:
            Nathan Xu
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: