KatieAmber
KatieAmber

Reputation: 77

Hibernate genericDao projection

I'm using Hibernate 4.2.7.Final with Google genericDAO 1.2.0. I'm interested in how can I write a search with group by?

For example:

select a, sum(b) from table group by a

with

Search search = new Search();
search.addFieldGroupBy("a"); //this does not exist, I need something like this
search.addField("b", Field.OP_SUM);

Upvotes: 1

Views: 317

Answers (1)

Kulbhushan Singh
Kulbhushan Singh

Reputation: 625

In hibernate group by query is same as your native SQL other then you will have here your Persistent Object name.

select a, sum(b) from table t group by t.a

Upvotes: 1

Related Questions