Project

General

Profile

Actions

Improvements #12342

open

Improve the Query interface

Added by Matthias Van Ceulebroeck 3 months ago.

Status:
InProgress
Priority:
Normal
Category:
-
Target version:
-
Start date:
01/22/2024
Due date:
% Done:

0%

Estimated time:

Description

Currently the Query interface is fairly basic. This works well to construct simpler queries (like: SELECT ... FROM table JOIN table2 WHERE .. ORDER ... LIMIT ... GROUP BY ...).

However, if the expressions table or table2 become more complex than simply the name of a table, this interface shows its limitations. All types of joins, simply take a string as the parameter. If we would select from a subquery, or try to join a complex query, we would have to write this query completely in the string, so we can use it. A much nicer interface will allow us to write code like:

Query subQuery = session.createQuery(....)
                 .where().bind();

Query mainQuery = session.createQuery(...)
                  .join(subQuery)
                  .where(...);

This makes queries much more readable and maintainable.

No data to display

Actions

Also available in: Atom PDF