View Javadoc
1   package org.itracker.persistence.dao;
2   
3   import org.apache.log4j.Logger;
4   import org.hibernate.Criteria;
5   import org.hibernate.HibernateException;
6   import org.itracker.model.WorkflowScript;
7   
8   import java.util.List;
9   
10  /**
11   *
12   */
13  public class WorkflowScriptDAOImpl extends BaseHibernateDAOImpl<WorkflowScript>
14          implements WorkflowScriptDAO {
15  
16      private static final Logger log = Logger.getLogger(WorkflowScript.class);
17  
18      /**
19       * Find a <code>WorkflowScript</code> by its primary key
20       *
21       * @param id primary key of the <code>WorkflowScript</code>
22       * @return The <code>WorkflowScript</code> found
23       */
24      public WorkflowScript findByPrimaryKey(Integer id) {
25          try {
26              WorkflowScriptcker/model/WorkflowScript.html#WorkflowScript">WorkflowScript workflowScriptBean = (WorkflowScript) getSession().get(WorkflowScript.class, id);
27              return workflowScriptBean;
28          } catch (HibernateException ex) {
29              log.error("findByPrimaryKey: failed with hibernate exception", ex);
30              throw convertHibernateAccessException(ex);
31          }
32      }
33  
34      /**
35       * Finds all <code>WorkflowScript</code>s
36       *
37       * @return a <code>Collection</code> with all <code>WorkflowScript</code>s
38       */
39      @SuppressWarnings("unchecked")
40      public List<WorkflowScript> findAll() {
41          Criteria criteria = getSession().createCriteria(WorkflowScript.class);
42          try {
43              return criteria.list();
44          } catch (HibernateException e) {
45              throw convertHibernateAccessException(e);
46          }
47      }
48  
49  }