Spring JPA
I am tryna Delete the forgotPassword Enetity if the Otp expired time is passed out and that is 10 sec right now but after the Otp time expired the otp entity is not deleting itself from Db . Here is the implemet Can anyone help
if (forgotPassword.getOtpExpireDate().before(Date.from(Instant.now()))) {
if (forgotPassword.getOtpExpireDate().before(Date.from(Instant.now()))) {
Long fId = forgotPassword.getForgotpasswordId();
System.out.println("The Password id is "+ fId);
emailService.deleteForgotPasswordById(fId);
logger.warn("The Time is expired", forgotPassword.getOtpExpireDate());
throw new OtpNotFoundExcpetion("Otp Expired");
}
}