String sql = "select c.id, c.surname, c.name, c.pathronymic, c.born, c.snils from Client c WHERE c.id=132702";
Query query = manager.createQuery(sql);
List<Object[]> list = query.getResultList();
for (Object[] line: list) {
DloClientUnique dcu = new DloClientUnique();
Integer clientID = (Integer) line[0];
Surname surname = (Surname) line[1];
Name name = (Name) line[2];
Patronymic pathronymic = (Patronymic) line[3];
dcu.surnameID = surname == null ? 0 : surname.getId();
dcu.nameID = name == null ? 0 : name.getId();
dcu.pathronID = pathronymic == null ? 0 : pathronymic.getId();
dcu.dateBorn = (Date) line[4];
dcu.snils = line[5] != null ? ((String) line[5]).trim() : "";
clientMap.put(dcu, clientID);
}
for (FacilityClient fc : facClientList) {
Surname surname = fc.getSurname();
Name name = fc.getName();
Patronymic patronymic = fc.getPathronymic();
Date born = fc.getBorn();
String snils = fc.getSnils();
DloClientUnique dcu = new DloClientUnique();
dcu.surnameID = surname == null ? 0 : surname.getId();
dcu.nameID = name == null ? 0 : name.getId();
dcu.pathronID = patronymic == null ? 0 : patronymic.getId();
dcu.dateBorn = born;
dcu.snils = snils != null ? snils.trim() : "";