title: unable to get all values of json
body: <p>I am trying to return values fetched from database to frontend view using rest webservice but the problem is its returning only the one line(first line) of json values</p>
  
  <p>I have json like this:</p>
  
  <pre><code>{"jobName":"NASA Scientist","jobPrimarySkill":null,"jobRole":"JOB_ROLE","jobDesignation":"JOB_EXP","jobDescription":"Sample 2","jobSalaryRange":"JOB_POSITIONS","jobExp":"JOB_SAL_RANGE","jobPositions":"JOB_POSTEDBY","jobPostedBy":null}
  {"jobName":"NASA Scientist","jobPrimarySkill":null,"jobRole":"JOB_ROLE","jobDesignation":"JOB_EXP","jobDescription":"JOB_DESCRIPTION","jobSalaryRange":"JOB_POSITIONS","jobExp":"JOB_SAL_RANGE","jobPositions":"JOB_POSTEDBY","jobPostedBy":null}
  {"jobName":"Web developer","jobPrimarySkill":null,"jobRole":"JOB_ROLE","jobDesignation":"JOB_EXP","jobDescription":"XYZ 123","jobSalaryRange":"JOB_POSITIONS","jobExp":"JOB_SAL_RANGE","jobPositions":"JOB_POSTEDBY","jobPostedBy":null}
  {"jobName":"Web developer","jobPrimarySkill":null,"jobRole":"JOB_ROLE","jobDesignation":"JOB_EXP","jobDescription":"JOB_DESCRIPTION","jobSalaryRange":"JOB_POSITIONS","jobExp":"JOB_SAL_RANGE","jobPositions":"JOB_POSTEDBY","jobPostedBy":null}
  {"jobName":"Programmer","jobPrimarySkill":null,"jobRole":"JOB_ROLE","jobDesignation":"JOB_EXP","jobDescription":"JOB_DESCRIPTION","jobSalaryRange":"JOB_POSITIONS","jobExp":"JOB_SAL_RANGE","jobPositions":"JOB_POSTEDBY","jobPostedBy":null}
  {"jobName":"Programmer","jobPrimarySkill":null,"jobRole":"JOB_ROLE","jobDesignation":"JOB_EXP","jobDescription":"JOB_DESCRIPTION","jobSalaryRange":"JOB_POSITIONS","jobExp":"JOB_SAL_RANGE","jobPositions":"JOB_POSTEDBY","jobPostedBy":null}
  </code></pre>
  
  <p>Its returning only first line of json values to the front end rather than all of them. I am adding the fetched values from database to <code>List</code> and exposing it in webservice like this:</p>
  
  <pre><code>public class FetchJobSummaryDAO {
  
  public List getJobSummaries() {
  
  JobSummaries jobSummaries = new JobSummaries();
  List&lt;JobSummaries&gt; jobSummaryList = new ArrayList&lt;JobSummaries&gt;();
  
  try {
      Connection con = DBConnection.getConnection();
  
      String query = "select JOB_NAME,JOB_DESCRIPTION,JOB_ROLE,JOB_PRIMARY_SKILL,JOB_DESIGNATION,JOB_EXP,JOB_SAL_RANGE, JOB_POSTEDBY from TBL_JOBPOSTING";
  
      PreparedStatement pst = con.prepareStatement(query);
      ResultSet rs = pst.executeQuery();
  
      ResultSetMetaData rsmd = rs.getMetaData();
      int columnsNumber = rsmd.getColumnCount();
      while (rs.next()) {
          jobSummaries.setJobName(rs.getString("JOB_NAME"));
          jobSummaries.setJobDescription(rs.getString("JOB_DESCRIPTION"));
          jobSummaries.setJobRole(rs.getString("JOB_ROLE"));
          jobSummaries.setJobPrimarySkill(rs.getString("JOB_PRIMARY_SKILL"));
          jobSummaries.setJobDesignation(rs.getString("JOB_DESIGNATION"));
          jobSummaries.setJobExp(rs.getString("JOB_EXP"));
          jobSummaries.setJobSalaryRange(rs.getString("JOB_SAL_RANGE"));
          jobSummaries.setJobPostedBy(rs.getString("JOB_POSTEDBY"));
          jobSummaryList.add(jobSummaries);
  
          for (int i = 1; i &lt;= columnsNumber; i++) {
              if (i &gt; 1) {
                  System.out.print(",  ");
              }
              String columnValue = rs.getString(i);
              System.out.print(rsmd.getColumnName(i) + " " + columnValue);
          }
          System.out.println("");
      }
  
  } catch (SQLException ex) {
      Logger.getLogger(FetchJobSummaryDAO.class.getName()).log(Level.SEVERE, null, ex);
  }
  return jobSummaryList;
  }
  </code></pre>
  
  <p>webservice:</p>
  
  <pre><code>@Path("/FetchJobSummary")
  public class FetchJobSummaryService {
  FetchJobSummaryDAO dao = new FetchJobSummaryDAO();
  
  @GET
  @Produces(MediaType.APPLICATION_JSON)
  public List&lt;JobSummaries&gt; fetch() {
      List js = dao.getJobSummaries();
      for(int i=0; i&lt; js.size(); i++){
          System.out.println(js); //prints values with same hashcode
      }
      return dao.getJobSummaries();
      }
  }
  </code></pre>
  
  <p>When I print the list, it prints values with same hashcode so I guess its getting only one value of json</p>
  
  <pre><code>[com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809]
  [com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809]
  [com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809]
  [com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809]
  [com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809]
  [com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809, com.RTH.WebServices.JobSummaries@691c5809]
  </code></pre>