1 package org.itracker.persistence.dao; 2 3 import org.hibernate.HibernateException; 4 import org.hibernate.Query; 5 import org.itracker.model.IssueHistory; 6 7 import java.util.List; 8 9 public class IssueHistoryDAOImpl extends BaseHibernateDAOImpl<IssueHistory> 10 implements IssueHistoryDAO { 11 12 public IssueHistoryDAOImpl() { 13 } 14 15 public IssueHistory findByPrimaryKey(Integer entryId) { 16 try { 17 return (IssueHistory) getSession().get(IssueHistory.class, entryId); 18 } catch (HibernateException ex) { 19 throw convertHibernateAccessException(ex); 20 } 21 } 22 23 @SuppressWarnings("unchecked") 24 public List<IssueHistory> findByIssueId(Integer issueId) { 25 List<IssueHistory> history; 26 27 try { 28 Query query = getSession().getNamedQuery( 29 "IssueHistoryByIssueQuery"); 30 query.setInteger("issueId", issueId); 31 history = query.list(); 32 } catch (HibernateException ex) { 33 throw convertHibernateAccessException(ex); 34 } 35 return history; 36 } 37 38 }