Rob,
I am still interested in using EBean for my web projects at work
instead of Hibernate. However, I still have one feature I can't match
yet...
We have a feature where we scroll data on a web page. You see these
everywhere. Basically there is too many rows in the database to show
at once so we allow the user to page through the data. In order to do
this on one spot we have a utility class PageScroller which takes a
Hibernate Criteria object (The Full Query), and reads common request
parameters for the page and then modifies the Criteria object on the
fly to only pull the results of the page.
That was kind of long winded, but I have replaced Criteria with your
Query object and have gotten almost everything converted except
getting a row count from the original Query.
In hibernate we do the following:
Criteria crit; // The passed in criteria object
crit.setProjection(Projections.rowCount());
Integer count = (Integer) crit.uniqueResult();
int totalItems = count.intValue();
// Put criteria back to original state
crit.setProjection(null);
crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
I have posted this in your forums before. We discussed either a
Query.clone() method or a Query.rowCount() method. I would prefer
rowCount() which would execute the Query except with a COUNT(*) in the
select clause. I am sure there would be other uses for this besides
the one I have described.
P.S. I can't login to the
http://www.avaje.org/ site anymore. Did
you decide to just move to google groups?