Saturday 15 June 2013

java - Distinct function with Criteria -


I want to execute this question with Criterias but it seems that it is not working as expected: / P>

  Select different details, ID, Family_Id, number-by-volume family details WHERE familia_id by group;   

I have tried this

  public list getFamiliasPadre () {criteria cri = getSession (). CreateCriteria (Familia.class); Cri.add (Ban.InslL ("familia.id")). Setprogress (project names (projects "properties") .setProjection (Projections.groupProperty ("descripcion"); return cri.list ();}   

but this is a result As I was executing this query

  select different details from the family WHERE familia_id by descriptor by IS NULL GROUP;   

This only gives the column descripcion

My question is, how can I say in hibernation that I want all the columns in my table But I do not want to repeat voices from the desaulpcion column?

You do not do this in just plain SQL queries I mean, how can you possibly merge 2 rows that only share one column? For example, imagine this in your table:

  • familiaId - descripcion - Otro
  • 1) null - algo - foo
  • 2) blank - algo - bar

    There is no way that DISTINCT is just a column May apply to Zaki could leave aside, because you will only have one line for those two lines

No comments:

Post a Comment