Esempio n. 1
0
 @Override
 @Transactional
 public Boolean delete(Integer id) {
   List<OrderReader> list = readerDAO.findOwerReaders(id);
   if (list.isEmpty()) {
     readerDAO.delete(id);
     return true;
   } else return false;
 }
Esempio n. 2
0
 @Override
 @Transactional
 public Boolean save(Reader reader) {
   Reader r =
       readerDAO.findReaderByFullName(reader.getName(), reader.getSurname(), reader.getBirth());
   if (r == null) {
     readerDAO.save(reader);
     return false;
   } else {
     return true;
   }
 }
Esempio n. 3
0
 @Override
 @Transactional
 public void update(Reader reader, Integer id) {
   Reader reader1 = findById(id);
   reader1.setPhone(reader.getPhone());
   reader1.setName(reader.getName());
   reader1.setSurname(reader.getSurname());
   reader1.setBirth(reader.getBirth());
   reader1.setAdress(reader.getAdress());
   readerDAO.update(reader1);
 }
Esempio n. 4
0
 @Override
 @Transactional
 public List<Reader> findAll() {
   return readerDAO.findAll();
 }
Esempio n. 5
0
 @Override
 @Transactional
 public Reader findById(Integer id) {
   return readerDAO.find(id);
 }