1

There is sql statement

select distinct create_date from articles

Is it possibele to write this statement using HQL?

Cheers!

glebreutov
  • 765
  • 1
  • 7
  • 18
  • possible duplicate of http://stackoverflow.com/questions/263850/how-do-you-create-a-distinct-query-in-hql – extraneon Apr 20 '10 at 18:09

1 Answers1

5

Yes, it is. HQL supports the DISTINCT keyword.

SELECT DISTINCT a.createDate FROM Article a

I'd propose naming your entity Article (rather than articles) and to use camelCase (rather than under_score)

Bozho
  • 554,002
  • 136
  • 1,025
  • 1,121