List of usage examples for com.liferay.portal.kernel.dao.orm Query setCacheable
public Query setCacheable(boolean cacheable);
From source file:org.oep.cmon.dao.tlct.service.persistence.TaiLieuChungThucFinderImpl.java
License:Apache License
/** * This is fucntion findByHoSoId/*from www . j a v a2s .c o m*/ * Version: 1.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param Long hosoId * @return List<TaiLieuChungThuc> */ public List<TaiLieuChungThuc> findByHoSoId(Long hosoId) { Session session = null; StringBuffer sql = new StringBuffer(); List<TaiLieuChungThuc> list = new ArrayList<TaiLieuChungThuc>(); try { session = openSession(); sql.append("SELECT d from TaiLieuChungThuc d "); sql.append(" WHERE d.hoSoTTHCCId = ? "); sql.append(" AND d.danhMucGiayToId is null "); sql.append(" AND d.trangThai = 0 "); sql.append(" ORDER BY d.id DESC "); Query q = session.createQuery(sql.toString()); q.setCacheable(false); QueryPos qPos = QueryPos.getInstance(q); qPos.add(hosoId); list = (List<TaiLieuChungThuc>) QueryUtil.list(q, getDialect(), QueryUtil.ALL_POS, QueryUtil.ALL_POS, false); return list; } catch (Exception e) { e.printStackTrace(); } finally { closeSession(session); return list; } }