1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.imca.model.entities;
17
18 import java.util.List;
19
20 import javax.persistence.EntityManager;
21 import javax.persistence.Query;
22
23 public class SailNumberDAO {
24
25 @SuppressWarnings("unchecked")
26 public SailNumberEntity findSailNumber(EntityManager em, String sailNumber) {
27
28 SailNumberEntity sailNum = null;
29
30 Query query = em.createNamedQuery("findSailNumberBySailNumber");
31 query.setParameter("sailNumber", sailNumber);
32 List<SailNumberEntity> list = query.getResultList();
33
34 if (list.size() != 0) {
35 sailNum = list.get(0);
36 }
37
38 return sailNum;
39
40 }
41 }