View Javadoc

1   package com.panogenesis.dao.hibernate;
2   
3   import java.util.List;
4   
5   import com.panogenesis.model.IssueHistory;
6   import com.panogenesis.dao.IssueHistoryDAO;
7   
8   import org.springframework.orm.ObjectRetrievalFailureException;
9   
10  public class IssueHistoryDAOHibernate extends BaseDAOHibernate implements IssueHistoryDAO {
11  
12      /***
13       * @see com.panogenesis.dao.IssueHistoryDAO#getIssueHistorys(com.panogenesis.model.IssueHistory)
14       */
15      public List getIssueHistorys(IssueHistory issueHistory) {
16          // use the issueHistory parameter to do futher filtering if you need to
17          return getHibernateTemplate().find("from IssueHistory");
18      }
19  
20      /***
21       * @see com.panogenesis.dao.IssueHistoryDAO#getIssueHistory(final Integer id)
22       */
23      public IssueHistory getIssueHistory(final Integer id) {
24          IssueHistory issueHistory = (IssueHistory) getHibernateTemplate().get(IssueHistory.class, id);
25          if (issueHistory == null) {
26              log.warn("uh oh, issueHistory with id '" + id + "' not found...");
27              throw new ObjectRetrievalFailureException(IssueHistory.class, id);
28          }
29  
30          return issueHistory;
31      }
32  
33      /***
34       * @see com.panogenesis.dao.IssueHistoryDAO#saveIssueHistory(IssueHistory issueHistory)
35       */    
36      public void saveIssueHistory(final IssueHistory issueHistory) {
37          getHibernateTemplate().saveOrUpdate(issueHistory);
38      }
39  
40      /***
41       * @see com.panogenesis.dao.IssueHistoryDAO#removeIssueHistory(final Integer id)
42       */
43      public void removeIssueHistory(final Integer id) {
44          getHibernateTemplate().delete(getIssueHistory(id));
45      }
46  }