Ejemplo n.º 1
0
 @Transactional
 @Override
 public Textbook update(Textbook object) {
   Textbook obj = textbookRepo.findOne(object.getId());
   if (obj != null) {
     updateChapters(object.getChapters(), obj);
     updateSubject(object.getSubject(), obj);
     updateName(object.getName(), obj);
     textbookRepo.saveAndFlush(obj);
   }
   return obj;
 }
Ejemplo n.º 2
0
 @Transactional
 @Override
 public Textbook delete(Long id) {
   Textbook obj = textbookRepo.findOne(id);
   if (obj != null) {
     Subject subject = obj.getSubject();
     if (subject != null) {
       subject.removeTextbook(obj);
       subjectRepo.saveAndFlush(subject);
     }
     textbookRepo.delete(obj);
     textbookRepo.flush();
   }
   return null;
 }
Ejemplo n.º 3
0
 @Transactional
 @Override
 public Textbook read(Long id) {
   return textbookRepo.findOne(id);
 }