2009-02-25 4 views

답변

36

Hibernate 문서에서 동작의 사양을 찾지 못했지만 HQL의 between 연산자는 SQL의 between 연산자로 변환되었습니다.

그래서 HQL에서 between은 그

A between 5 and 10 

분명이에 관한 약간의 혼동이

A >= 5 and A <= 10 
+1

여기 사이 JPQL의 사양입니다 : http://docs.oracle.com/cd/E17904_01 /apirefs.1111/e13946/ejb3_langref.html#ejb3_langref_between – gerrytan

2

에 해당하고, 또한 포함한다. 자연어는 그것이 배타적이라고 제안 할 것이다. 그러나 이것은 사실이 아니다. 실제로는 A> = 5이고 A는 < = 10입니다. 이미 답은 더 설명이있을 필요가 주어진 (그리고 delted) 모순이 된 이후 (http://www.techonthenet.com/sql/between.php에서)

Example #1 - Numbers 

The following is an SQL statement that uses the BETWEEN function: 

SELECT * 
FROM suppliers 
WHERE supplier_id between 5000 AND 5010; 

This would return all rows where the supplier_id is between 5000 and 5010, inclusive. It is equivalent to the following SQL statement: 

SELECT * 
FROM suppliers 
WHERE supplier_id >= 5000 
AND supplier_id <= 5010;