title: SpringBoot and Hibernate not able to retrieve a list of objects based on criteria provided
body: <p>I have an issue when trying to get a list of objects from Database using SpringBoot and Hibernate/JPA. In database I have listed RFIs with one of the fields being open/close/more to follow. The goal is to retrieve a whole list of all open RFIs and insert them into view. When I run code below I only a bunch of console outputs with null value, and the last one has something different. Can you please let me know what I'm doing wrong?</p>
  
  <p>Here is my code below
  model:</p>
  
  <pre><code>package com.robi.PlanningRfiTracker.model;
  
      import java.util.Date;
      import javax.persistence.Entity;
      import javax.persistence.GeneratedValue;
      import javax.persistence.GenerationType;
      import javax.persistence.Id;
  
      @Entity
      public class Rfi {
  
          @Id
          @GeneratedValue(strategy = GenerationType.AUTO)
          private Long id;
          private String pprnumber;
          private String title;
          private String site;
          private String rfi;
          private Date datesubmitted;
          private String response;
          private String receivedfrom;
          private Date datereceived;
          private String status;
          private String attachment1;
          private String attachment2;
          private String attachment3;
          private String attachment4;
          private String attachment5;
          private String attachment6;
          private String attachment7;
          private String attachment8;
          private String attachment9;
          private String attachment10;
  
  
          public Rfi(Long id, String pprnumber, String title, String site, String rfi, Date datesubmitted, String response,
                  String receivedfrom, Date datereceived, String status, String attachment1, String attachment2,
                  String attachment3, String attachment4, String attachment5, String attachment6, String attachment7,
                  String attachment8, String attachment9, String attachment10) {
              super();
              this.id = id;
              this.pprnumber = pprnumber;
              this.title = title;
              this.site = site;
              this.rfi = rfi;
              this.datesubmitted = datesubmitted;
              this.response = response;
              this.receivedfrom = receivedfrom;
              this.datereceived = datereceived;
              this.status = status;
              this.attachment1 = attachment1;
              this.attachment2 = attachment2;
              this.attachment3 = attachment3;
              this.attachment4 = attachment4;
              this.attachment5 = attachment5;
              this.attachment6 = attachment6;
              this.attachment7 = attachment7;
              this.attachment8 = attachment8;
              this.attachment9 = attachment9;
              this.attachment10 = attachment10;
          }
  
  
          public Rfi() {
              super();
          }
  
          public Long getId() {
              return id;
          }
  
          public void setId(Long id) {
              this.id = id;
          }
  
          public String getPprnumber() {
              return pprnumber;
          }
  
          public void setPprnumber(String pprnumber) {
              this.pprnumber = pprnumber;
          }
  
          public String getTitle() {
              return title;
          }
  
          public void setTitle(String title) {
              this.title = title;
          }
  
          public String getSite() {
              return site;
          }
  
          public void setSite(String site) {
              this.site = site;
          }
  
          public String getRfi() {
              return rfi;
          }
  
          public void setRfi(String rfi) {
              this.rfi = rfi;
          }
  
          public Date getDatesubmitted() {
              return datesubmitted;
          }
  
          public void setDatesubmitted(Date datesubmitted) {
              this.datesubmitted = datesubmitted;
          }
  
          public String getResponse() {
              return response;
          }
  
          public void setResponse(String response) {
              this.response = response;
          }
  
          public String getReceivedfrom() {
              return receivedfrom;
          }
  
          public void setReceivedfrom(String receivedfrom) {
              this.receivedfrom = receivedfrom;
          }
  
          public Date getDatereceived() {
              return datereceived;
          }
  
          public void setDatereceived(Date datereceived) {
              this.datereceived = datereceived;
          }
  
          public String getStatus() {
              return status;
          }
  
          public void setStatus(String status) {
              this.status = status;
          }
  
          public String getAttachment1() {
              return attachment1;
          }
  
          public void setAttachment1(String attachment1) {
              this.attachment1 = attachment1;
          }
  
          public String getAttachment2() {
              return attachment2;
          }
  
          public void setAttachment2(String attachment2) {
              this.attachment2 = attachment2;
          }
  
          public String getAttachment3() {
              return attachment3;
          }
  
          public void setAttachment3(String attachment3) {
              this.attachment3 = attachment3;
          }
  
          public String getAttachment4() {
              return attachment4;
          }
  
          public void setAttachment4(String attachment4) {
              this.attachment4 = attachment4;
          }
  
          public String getAttachment5() {
              return attachment5;
          }
  
          public void setAttachment5(String attachment5) {
              this.attachment5 = attachment5;
          }
  
          public String getAttachment6() {
              return attachment6;
          }
  
          public void setAttachment6(String attachment6) {
              this.attachment6 = attachment6;
          }
  
          public String getAttachment7() {
              return attachment7;
          }
  
          public void setAttachment7(String attachment7) {
              this.attachment7 = attachment7;
          }
  
          public String getAttachment8() {
              return attachment8;
          }
  
          public void setAttachment8(String attachment8) {
              this.attachment8 = attachment8;
          }
  
          public String getAttachment9() {
              return attachment9;
          }
  
          public void setAttachment9(String attachment9) {
              this.attachment9 = attachment9;
          }
  
          public String getAttachment10() {
              return attachment10;
          }
  
          public void setAttachment10(String attachment10) {
              this.attachment10 = attachment10;
          }
  
          @Override
          public String toString() {
              return "Rfi [pprnumber=" + pprnumber + ", title=" + title + ", site=" + site + ", rfi=" + rfi
                      + ", datesubmitted=" + datesubmitted + ", response=" + response + ", receivedfrom=" + receivedfrom
                      + ", datereceived=" + datereceived + ", status=" + status + "]";
          }
  
      }
  </code></pre>
  
  <p>RfiDao:</p>
  
  <pre><code>package com.robi.PlanningRfiTracker.dao;
  
  import java.util.List;
  import org.springframework.data.repository.CrudRepository;
  import com.robi.PlanningRfiTracker.model.Rfi;
  
  public interface RfiDao extends CrudRepository&lt;Rfi, List&gt; {
      List&lt;Rfi&gt; findByStatus(String status);
  }
  </code></pre>
  
  <p>RfiService:</p>
  
  <pre><code>        package com.robi.PlanningRfiTracker.service;
  
      import java.util.List;
      import com.robi.PlanningRfiTracker.model.Rfi;
  
      public interface RfiService {
          List&lt;Rfi&gt; rfiStatus(String status);
      }
  
  RfiServiceImpl:
  
  
  
   package com.robi.PlanningRfiTracker.service.RfiServiceImpl;
  
  import java.util.List;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Service;
  import com.robi.PlanningRfiTracker.dao.RfiDao;
  import com.robi.PlanningRfiTracker.model.Rfi;
  import com.robi.PlanningRfiTracker.service.RfiService;
  
  @Service
  public class RfiServiceImpl implements RfiService {
  
      @Autowired
      private RfiDao rfiDao;
  
      @Override
      public List&lt;Rfi&gt; rfiStatus(String status) {
          return (List&lt;Rfi&gt;) rfiDao.findByStatus(status);
      }
  
  }
  </code></pre>
  
  <p>And I attached the picture of console output when I run this code above.</p>
  
  <p>Thank you
  <a href="https://i.stack.imgur.com/wYDb2.png" rel="nofollow noreferrer">Console Output</a></p>