Stream-based querying


Despite how crazy this idea sounds, there is an existing project that was the inspiration behind this: Linq Method Query Syntax

The idea would be simple on the API level, define the set of methods i.e.:

  • where

  • join

  • select

  • groupBy

  • orderBy

That would take a Predicate as parameter (or other suitable functional interface) allowing to construct queries in a form:

While this clearly introduces completly new syntax for creating queries next to existing HQL, criteria API and QBE it might be wort considering it.

The implementation definetly won't be trivial, but probably can be based on already widely used ASM that would have to be used to do the reverse enginering of the lambda statements.




Steve Ebersole
August 29, 2017, 12:18 PM

Giovanni, that would be awesome. It would have to live on top of 6.x
codebase which is unfortunately not yet compiling.

On Tue, Aug 29, 2017, 3:32 AM Giovanni Lovato (JIRA) <

Giovanni Lovato
August 29, 2017, 8:31 AM

This is very interesting. I'm working on implementations of Java 8 Stream, Predicate, Function,
Comparator and Collector which translates to Criteria API. That is:

I'd love to see this in ORM, and I'd love to share and contribute if of any interest!

Steve Ebersole
January 27, 2017, 12:08 PM

Also this is not so much "lambda queries". It is stream-based querying.

Steve Ebersole
May 13, 2016, 12:18 PM

Tentatively scheduled for 6.0. It will definitely have to wait for 6.x

Steve Ebersole
May 4, 2016, 4:32 PM

Broke out and slated as a New Feature. This is not something I plan on tackling any time soon. Maybe with 6.x after the redesign of querying in general.

, if you are interested in pursuing this contact us on the dev mailing list and we can discuss including this in the SQM work.




Jakub Narloch

Fix versions