Clover Coverage Report - itracker
Coverage timestamp: Tue May 1 2012 16:42:12 CEST
7   48   4   3.5
0   27   0.57   2
2     2  
1    
 
 
  VersionDAOImpl       Line # 13 7 4 0% 0.0
 
No Tests
 
1    package org.itracker.persistence.dao;
2   
3    import java.util.List;
4   
5    import org.hibernate.HibernateException;
6    import org.hibernate.criterion.Expression;
7    import org.itracker.model.Project;
8    import org.itracker.model.Version;
9   
10    /**
11    * Hibernate implementation of <code>VersionDAO</code> interface
12    */
 
13    public class VersionDAOImpl extends BaseHibernateDAOImpl<Version>
14    implements VersionDAO {
15   
16    /**
17    * find <code>Version</code> by id
18    *
19    * @param versionId id of the <code>Version</code> to find
20    * @return <code>Version</code> found
21    */
 
22  0 toggle public Version findByPrimaryKey(Integer versionId) {
23  0 try {
24  0 return (Version)getSession().get(Version.class, versionId);
25    } catch (HibernateException e) {
26  0 throw convertHibernateAccessException(e);
27    }
28    }
29   
30    /**
31    * Finds <code>Version</code>s by a project id and returns them as
32    * a <code>Collection</code>.
33    *
34    * @param projectId id of the parent <code>Project</code>
35    * @return a <code>Collection</code> containing the <code>Version</code>s found
36    */
 
37  0 toggle @SuppressWarnings("unchecked")
38    public List<Version> findByProjectId(Integer projectId) {
39  0 try {
40  0 Project project = (Project) getSession().load(Project.class,projectId);
41  0 return getSession().createCriteria(Version.class)
42    .add(Expression.eq("project", project))
43    .list();
44    } catch (HibernateException e) {
45  0 throw convertHibernateAccessException(e);
46    }
47    }
48    }