@Override public StudentEntity studentByUpdate(StudentEntity` studentEntity) { Optional <StudentEntity> studentDB= this.studentDataRepository.findById(studentEntity.getId()); //here above optional line i am getting error when iam using optional here then why?? How resolve this error..error say wrap optional or changet to empty optional, if(studentDB.isPresent()) { StudentEntity studentUpdate=studentDB.get(); studentUpdate.setId(studentEntity.getId()); studentUpdate.setName(studentEntity.getName()); studentUpdate.setEmail(studentEntity.getEmail()); studentUpdate.setAddress(studentEntity.getAddress()); return studentDataRepository.save(studentUpdate); }else{ System.out.println("Records not found...??"); } }
1.4m articles
1.4m replys
5 comments
57.0k users