View Javadoc

1   package org.itracker.persistence.dao;
2   
3   import java.util.List;
4   
5   import org.hibernate.Criteria;
6   import org.hibernate.HibernateException;
7   import org.itracker.model.CustomField;
8   
9   /**
10   * 
11   */
12  public class CustomFieldDAOImpl extends BaseHibernateDAOImpl<CustomField> 
13          implements CustomFieldDAO {
14  
15      public CustomField findByPrimaryKey(Integer customFieldId) {
16          try {
17              return (CustomField)getSession().get(CustomField.class, customFieldId);
18          } catch (HibernateException e) {
19              throw convertHibernateAccessException(e);
20          }
21      }
22      
23      @SuppressWarnings("unchecked") 
24      public List<CustomField> findAll() {
25          Criteria criteria = getSession().createCriteria(CustomField.class);
26          
27          try {
28              return criteria.list();
29          } catch (HibernateException e) {
30              throw convertHibernateAccessException(e);
31          }
32      }
33  
34  }