It’s been too long since I’ve blogged. Here is an interesting one. I recently had to modify old code. They were using jpa 2.0 in more of a 1.0 syntax. There was a very complex query with joins used for searching. There was pagination, sort of. They were not returning the total record count. So I decided to do a count on the same query as a happy medium until we can upgrade to a newer way of doing things.
I tried using the same query and predicates to do the count. I tried following several examples from stack overflows and forums. But, all the examples were with simple queries that did not do joins.
The biggest thing here is that I had to use different query objects and different predicate objects, while using the same root when creating the count predicates and the count query. It appears that query.from()…
View original post 57 more words