[hibernate-dev] Hibernate Disjunction Criteria broken: returns true for empty list of criteria

William Pugh pwilliam at google.com
Tue Oct 28 19:16:32 EDT 2008


When you form a Hibernate Disjunction criteria, but don't add any
clauses to it, you get a criteria that matches everything.

Generally, when you perform a reduction over an empty list, the
expected result is the identity element for the reduction. For
example, the sum of the empty list is 0, the product of the empty list
is 1, the conjunction of the empty list is true, and the disjunction
of the empty list is false.

Hibernate uses "1=1" as the SQL for both Conjunction and Disjunction
criteria if there is an empty list of criteria.

Seems to me that this is a bug, although Disjunction isn't documented,
so who knows what it is "supposed" to do.

Bill Pugh



More information about the hibernate-dev mailing list