Why does JPA Repository save method does not update entity details on production?

I am using spring data JPA I am trying to update the entity using the JPARepository method save() to update the entity details. Code I have written to update the entity works fine in development as expected. But the same code does not work on the production server it does not give any error only the code written inside the map() does not work. Below is my code

public Long updateQrCodeUrlByBusinessDetails(Long businessId, String menuUrl, MENU_TYPE menuType) {
        return qrCodeRepo.findByBusinessId(businessId) -> {



  • just my two cents.

    You should always return Optional from query results. You may have it as:

    In repository:

    Optional<List<BusinessQRCode>> findByBusinessId(Long businessId);

    In Service:

    public void updateQrCodeUrlByBusinessDetails(Long businessId, String menuUrl, MENU_TYPE menuType) {
    // Fetch iterate, if exist
    qrCodeRepo.findByBusinessId(businessId).ifPresent(qrCodes_ -> {
      qrCodes_.forEach(code_-> {

    Why use map when you are returning same qr. You can skip that part and also the collect function. We already have the list of qrCodes, just iterate them and set the values then save all at once.