if I write in HQL
A between 5 and 10
is that equivalent to
A >= 5 and A <= 10
or
A > 5 and A < 10
or some other of the 4 combinations?
I didn't find any specification of the behavior in the Hibernate docs, but the between operator in HQL is translated to the between operator in SQL, which is inclusive.
Differences between SQL and HQL: SQL is based on a relational database model whereas HQL is a combination of object-oriented programming with relational database concepts. SQL manipulates data stored in tables and modifies its rows and columns. HQL is concerned about objects and its properties.
HQL is suitable for executing Static Queries, where as Criteria is suitable for executing Dynamic Queries. HQL is to perform both select and non-select operations on the data, Criteria is only for selecting the data, we cannot perform non-select operations using criteria.
Features of HQLHQL supports polymorphism as well as associations, which in turn allows developers to write queries using less code as compared to SQL. In addition, HQL supports many other SQL statement and aggregate functions, such as sum() and max() and clauses, such as group by and order by.
I didn't find any specification of the behavior in the Hibernate docs, but the between
operator in HQL is translated to the between
operator in SQL, which is inclusive.
So between
in HQL is also inclusive, that is
A between 5 and 10
is equivalent to
A >= 5 and A <= 10
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With