List of usage examples for org.hibernate SharedSessionContract createNativeQuery
NativeQuery createNativeQuery(String sqlString);
From source file:com.romeikat.datamessie.core.base.dao.impl.DocumentDao.java
License:Open Source License
public List<LocalDate> getPublishedDates(final SharedSessionContract ssc) { // Query/*from w w w . ja v a 2 s . com*/ final StringBuilder hql = new StringBuilder(); hql.append("SELECT DISTINCT DATE(d.published) "); hql.append("FROM document d "); hql.append("WHERE d.published IS NOT NULL "); @SuppressWarnings("unchecked") final Query<Date> query = ssc.createNativeQuery(hql.toString()); // Execute final List<Date> publishedDates = query.list(); return Lists.transform(publishedDates, d -> DateUtil.toLocalDate(d)); }