RE: [coldbox:17042] Re: ColdBox Bundle 3.5.3 - CriteriaBuilder Error

Thanks Joel-- it sounds like you’re saying this is a behavior (bug?) in Hibernate. Is it true that someone using the Hibernate libraries directly in Java would encounter the same issue? If it’s a Hibernate thing, I would assume someone has run into this before. I wonder if there’s any known workarounds or Hibernate bug tickets to address it. Or perhaps, it’s considered to be proper behavior…

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

I’m not even sure it’s a bug anywhere. Criteria Builder (on both sides) is doing what it’s asked, and preparing SQL according to the criteria provided.

RE: doing it in Java, yes, the result would be the same. Here are some people complaining of the same issues:

http://stackoverflow.com/questions/2370221/remove-dynamically-an-ordering-to-the-result-set-in-org-hibernate-criteria
http://stackoverflow.com/questions/3759154/is-it-possible-to-remove-order-from-hibernate-criteria?rq=1
http://stackoverflow.com/questions/2433915/how-can-you-remove-a-criterion-from-criteria
http://labs.jodd.org/d/paginate-with-hibernate.html

It seems like the workaround is more or less to do what Don and I have done–run the count() before list(), or do two separate criteria queries with the same criteria (sans orderings on the count()).