title: JPA Query is not throwing any errors and I keep getting only null
body: <p>I'm fairly new to Spring and JPA.
  I have a User entity:</p>
  <pre><code>package com.cooksys.twitter.entities;
  
  import java.sql.Timestamp;
  import java.util.List;
  import javax.persistence.*;
  import com.fasterxml.jackson.annotation.JsonIgnore;
  import lombok.Getter;
  import lombok.Setter;
  import org.hibernate.annotations.CreationTimestamp;
  import lombok.NoArgsConstructor;
  
  @Table(name = &quot;user_table&quot;)
  @Entity
  @NoArgsConstructor
  @Getter
  @Setter
  public class User {
  
      @Id
      @GeneratedValue
      private Long id;
      
      @Embedded
      private Credentials credentials;
      
      @Embedded
      private Profile profile;
      
      @CreationTimestamp
      private Timestamp joined;
  
      @JsonIgnore
      @OneToMany(mappedBy = &quot;author&quot;, cascade = CascadeType.ALL)
      private List&lt;Tweet&gt; tweets;
  
      @ManyToMany(mappedBy = &quot;likes&quot;)
      private List&lt;Tweet&gt; likedTweets;
      
      @ManyToMany(mappedBy = &quot;following&quot;)
      private List&lt;User&gt; followers;
  
      
      @ManyToMany
      private List&lt;User&gt; following;
  
      @ManyToMany(mappedBy = &quot;userMentioned&quot;)
      private List&lt;Tweet&gt; mentions;
  
      @Column
      private boolean deleted;
  }
  </code></pre>
  <p>I have a Credentials entity:</p>
  <pre><code>package com.cooksys.twitter.entities;
  
  import javax.persistence.Column;
  import javax.persistence.Embeddable;
  
  import lombok.Data;
  import lombok.NoArgsConstructor;
  
  @NoArgsConstructor
  @Data
  @Embeddable
  public class Credentials {
      
      @Column(unique=true)
      private String username;
      
      private String password;
  }
  </code></pre>
  <p>I have my UserRepository:</p>
  <pre><code>package com.cooksys.twitter.repositories;
  
  import com.cooksys.twitter.entities.Credentials;
  import com.cooksys.twitter.entities.User;
  import org.springframework.data.jpa.repository.JpaRepository;
  import org.springframework.data.jpa.repository.Query;
  import org.springframework.stereotype.Repository;
  
  @Repository
  public interface UserRepository extends JpaRepository&lt;User, Long&gt; {
      User findByCredentials(Credentials credentials);
      User findByCredentials_Username(String username);
      User findByCredentialsUsernameAndPassword(String username, String password);
  }
  </code></pre>
  <p>I'm getting passed in a TweetRequestDto that has Credentials inside with a username and password. Now when I pass those credentials into my repository query :</p>
  <pre><code>User user = userRepository.findByCredentials_Username(tweetRequestDto.getCredentials().getUsername());
  </code></pre>
  <p>or any variation of the queries in my repository, I only get returned null. I know the credentials are correct and in the database.
  Any help is appreciated, thank you.</p>