Rev 1929 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1312 | jmachado | 1 | package pt.estgp.estgweb.domain.dao.impl; |
2 | |||
3 | import pt.estgp.estgweb.domain.CourseYear; |
||
4 | |||
5 | import java.util.List; |
||
6 | |||
7 | import static org.hibernate.criterion.Restrictions.eq; |
||
8 | |||
9 | /** |
||
10 | * Created by jorgemachado on 06/03/16. |
||
11 | */ |
||
12 | public class CourseYearDaoImpl extends CourseYearDao |
||
13 | { |
||
14 | public static CourseYearDaoImpl getInstance() |
||
15 | { |
||
16 | if (myInstance == null) |
||
17 | myInstance = new CourseYearDaoImpl(); |
||
18 | return (CourseYearDaoImpl) myInstance; |
||
19 | } |
||
20 | |||
21 | public List<CourseYear> findCourseYear(1.5.0/docs/api/java/lang/String.html">String code, 1.5.0/docs/api/java/lang/String.html">String importYear) |
||
22 | { |
||
23 | List<CourseYear> cYs = createCriteria() |
||
24 | .createAlias("course","c") |
||
25 | .add(eq("importYear", importYear)) |
||
26 | .add(eq("c.code",code)).list(); |
||
27 | return cYs; |
||
28 | } |
||
1930 | grupo1 | 29 | |
1916 | grupo1 | 30 | public CourseYear findCourseYearU(1.5.0/docs/api/java/lang/String.html">String code, 1.5.0/docs/api/java/lang/String.html">String importYear) |
31 | { |
||
1930 | grupo1 | 32 | List<CourseYear> cYs = findCourseYear(code, importYear); |
1916 | grupo1 | 33 | |
34 | if (cYs.isEmpty()) |
||
35 | return null; |
||
36 | |||
37 | return cYs.get(0); |
||
38 | } |
||
1930 | grupo1 | 39 | } |