Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does between in HQL compare strictly or not?

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?

like image 580
flybywire Avatar asked Feb 25 '09 13:02

flybywire


People also ask

Is HQL between inclusive?

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.

What is HQL write difference between HQL and SQL?

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.

What is difference between HQL and Criteria in Hibernate?

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.

What are the basic properties of HQL?

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.


1 Answers

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 
like image 77
Dan Berindei Avatar answered Sep 22 '22 03:09

Dan Berindei