public List
fetchDetailMetrics(Date dateFrom, Date dateTo, String navPage, String navOption, OrganizationDTO org) {
List
pageViews = new ArrayList (); log.warn("Date from " + dateFrom + " to " + dateTo);
DetachedCriteria metrics = DetachedCriteria.forClass(MetricsForUserSession.class);
metrics.add(Expression.between("dateTime", dateFrom, dateTo));
metrics.add(Expression.eq("navOption", navOption));
metrics.add(Expression.eq("navPage", navPage));
if (org != null)
{
log.warn(" org " + org.getName());
metrics.add(Expression.eq("organization.id", org.getId()));
}
ProjectionList projectList = Projections.projectionList();
// group by
projectList.add(Projections.groupProperty("entityId"));
// alias of the column head
projectList.add(Projections.alias(Projections.rowCount(), "count"));
metrics.setProjection(projectList);
// order by, sorting
metrics.addOrder(Order.desc("count"));
List
if (results == null || results.size() <>
log.warn("fetched nothing");
else
log.warn("fetched " + results.size());
log.warn("fetched navPages " + results.size());
for (Object[] column : results)
{
log.warn(column[0] + " " + column[1]);
PageView pageView = new PageView();
determineDescription(pageView, column, navPage);
pageView.setViewCount(new Integer(column[1].toString()));
pageViews.add(pageView);
}
return pageViews;
}
I write about evolutionary anthropology, behavioral sciences, and related AI, particularly small, specialized Deep Neural Networks and LLMs.
Hibernate Detached criteria with projections (GROUP BY)
Examples of Spring/Hibernate compare, group by, order by (sort) functionality:
Subscribe to:
Post Comments (Atom)
Post Scriptum
The views in this article are mine and do not reflect those of my employer.
I am preparing to cancel the subscription to the e-mail newsletter that sends my articles.
Follow me on:
X.com (Twitter)
LinkedIn
Google Scholar
I am preparing to cancel the subscription to the e-mail newsletter that sends my articles.
Follow me on:
X.com (Twitter)
Google Scholar
My favorite quotations..
“A man should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.” by Robert A. Heinlein
"We are but habits and memories we chose to carry along." ~ Uki D. Lucas
Popular Recent Posts
-
In my journey building software and managing technology teams, I've often witnessed the allure and danger of what Melissa Perri aptly na...
-
This is an example of an entertaining, AI-generated fictional story posing as “real-life stories”. I believe this “posing” should be outlawe...
-
I tested to belong to Haplogroup R1b1b2a1a1d1. Subclade R1b1b2a1a1d1* (as named by 23andMe ) or R1b1a2a1a1a4 (per FTDNA ) is a paternal (...
-
I have run a quick test on a few LLM models I have installed locally on Mac OS with 64 GB of RAM. The test was conducted in English, but it ...
-
Physics and the laws of relativity: in parent-child relationship sound waves reach the subject after 25 years.
-
In my LM Studio, I have been using the 12 billion and 24 billion parameter models on my relatively inexpensive Mac Studio M1, which has 64 G...
-
Choice D Since we are currently renting, we started looking at the houses we could afford. This place fits our budget, but the baby blue col...
-
Do you know how it is when you stumble upon a foreign phrase that's wildly different in your language? It can be quite the head-scratche...
Most Popular Articles
-
In my journey building software and managing technology teams, I've often witnessed the allure and danger of what Melissa Perri aptly na...
-
I have noticed a very unsettling statistic on my blog. This prompted a fascinating question about AI, blogs' future, and maybe even the...
-
I tested to belong to Haplogroup R1b1b2a1a1d1. Subclade R1b1b2a1a1d1* (as named by 23andMe ) or R1b1a2a1a1a4 (per FTDNA ) is a paternal (...
-
Choice D Since we are currently renting, we started looking at the houses we could afford. This place fits our budget, but the baby blue col...
-
Prompt: What do you really see in the selfie of myself? AI: I see a volcano about to blow up and I see a lost, scared boy in front of it. ...
-
This is an example of an entertaining, AI-generated fictional story posing as “real-life stories”. I believe this “posing” should be outlawe...
-
I decided to write down a few thoughts to clarify my obsessions with creating the "multitude" of AI agents that rely on the privat...
-
Something subtle but powerful just landed in my AI pipeline: agent_Observer. It listens. Not to spy, but to sense the mood and intent. It ...
-
Sometimes the AI chats surprise me on a new level. Here is an interaction I just had when fixing my AIKO app's Human-AI Interaction (HAi...
No comments:
Post a Comment
Please be polite.