|CriteriaBuilder aborted [message #646289]
||Thu, 23 December 2010 08:00
| Tom Eugelink
Registered: July 2009
Just giving my opinion / FWTW feedback. I've been in the process of moving to using the new CriteriaBuilder API instead of the string queries the last months, and gave up on it yesterday.|
Yesterday I had to write a sum query and that was the last drop. Not because I thought I wasn't able to get it working (in the end), but the expected time it would cost me. There was very limited documentation and trying to figure it out using the Javadoc documentation and the one example I found on the internet was a puzzle. I mean; it is a simple sum query. I know how to write it in SQL and in JPQL, but it seemed it would cost me half a century worth of study to write it using the CB. For example: it seems to require something called a TupleQuery. WTF? What kind of implementation details are being thrown around in the API? "S-U-M" not tuple. Yes, I know what is required underneath, but please do not bother me with it. I thought the CB was about making things typesafe, not more complex.
Anyhow, it's back to JPQL for now and I'm going to give LiquidForm another look. How to do a sum there took me a 20 seconds google, and the syntax actually makes sense.
String q = select(sum((o.getCustomer(), o.getTotalprice()))
One question remains: what drug was the standard committee on when they dreamt up this CriteriaBuilder monstrosity?
Powered by FUDForum
. Page generated in 0.07928 seconds