title: Spring Data findById returns cached value instead of database one
body: <p>I am preparing notification system for API which I've build before.
  Basically I have an aspect which listens on <code>projectRepository.save</code> method. What I want to achieve is check project status in an entity which is a parameter for save method with original status from database record. What I have notice is that when I search for the DB record by id it returns cached value so it is always the same as the object which is in save method even if database still have old value. Can I force Spring Data Jpa to return database record instead of cached entity?</p>
  <pre><code>@Aspect
  @Component
  @RequiredArgsConstructor
  public class NotificationAspect {
      private final UserService userService;
      private final ProjectRepository projectRepository;
      private final NotificationService notificationService;
  
      @Pointcut(&quot;execution(* *com.stars.domain.project.ProjectRepository.save(..))&quot;)
      public void projectSavePointcut() {}
  
      @Before(&quot;projectSavePointcut()&quot;)
      public void sendNotificationOnStatusChange(JoinPoint joinPoint) {
          if(joinPoint.getArgs().length &gt; 0 &amp;&amp; joinPoint.getArgs()[0] instanceof Project) {
              Project projectToUpdate = (Project) joinPoint.getArgs()[0];
              Optional&lt;Project&gt; oldProject = projectRepository.findById(projectToUpdate.getProjectId());
              if(oldProject.isPresent() &amp;&amp; !oldProject.get().getStatus().equals(projectToUpdate.getStatus())) {
                  notificationService.saveNotification(
                          MessageFormat.format(&quot;Project: {} status has been changed from: {} to: {}&quot;,
                                  projectToUpdate.getName(),
                                  oldProject.get().getStatus(),
                                  projectToUpdate.getStatus()),
                          List.of(userService.getUser(projectToUpdate.getCreatedBy())));
              }
          }
      }
  }
  </code></pre>
  <p>This line always returns true even if database record has different value.</p>
  <pre><code>oldProject.get().getStatus().equals(projectToUpdate.getStatus())
  </code></pre>