title: Loop throws exception before adding records
body: <p>I try to extract the <code>jobList</code> for a specific recruiter with "username". So everything executes good and I can print the recruiter username for the jobs I get from looping through the list. but the problem is that: <code>jobList.add(j)</code> is not executed and then it directly throws the hibernate exception. Does anyone know what the problem is?</p>
  
  <p>I know I should be using appropriate queries but I get exceptions all the time, my database is very small (school project), so it doesn't matter now.</p>
  
  <pre><code>public List&lt;Job&gt; list(String userName) throws AdException {
  
      try {
          begin();
          Query q = getSession().createQuery("FROM Job");
          ArrayList&lt;Job&gt; list = (ArrayList&lt;Job&gt;) q.list();
          System.out.println("All Jobs: "+ list);
  
          ArrayList&lt;Job&gt; jobList = new ArrayList&lt;Job&gt;();
  
          for (Job j : list) {
              System.out.println("job userName is: "+ j.getRecruiter().getUserName());
              if (j.getRecruiter().getUserName().equalsIgnoreCase("userName")){
  
                  jobList.add(j);
                  System.out.println("jobList is: "+ jobList);
                  return jobList;
  
              } else {
                  continue;
              }
  
          }
  
      } catch (HibernateException e) {
          rollback();
          throw new AdException("Could not get jobList for company: " + userName, e);
      }
  
      return null;
  }
  </code></pre>