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 import javax.persistence.EntityManager;
20 import javax.persistence.Query;
21
22 public class PersonDAO {
23
24 @SuppressWarnings("unchecked")
25 public PersonEntity findPersonByXmlId(EntityManager em, String xmlId) {
26
27 PersonEntity person = null;
28
29 if (!"".equals(xmlId)) {
30 Query query = em.createNamedQuery("findPersonByXmlId");
31 query.setParameter("xmlId", xmlId);
32 List<PersonEntity> list = query.getResultList();
33 if (list.size() != 0) {
34 person = list.get(0);
35 }
36 }
37 return person;
38
39 }
40
41 }