title: javax.persistence.TypedQuery.getSingleResult() NoResultException even though record exist
body: <p>javax.persistence.TypedQuery.getSingleResult() NoResultException even though record exist. Below code is good with 99% record, but no result with 1%. DB is sqlserver 2016. I had emplt list when I used javax.persistence.Query createNativeQuery and query.getResultList().</p>
  
  <pre><code>public TApplicationDocument getDocumentById(int id) {  
          TypedQuery&lt;TApplicationDocument&gt; q = getEntityManager().createQuery(  
                  "FROM TApplicationDocument  where transientKey =   :transientKey", TApplicationDocument.class);  
          q.setParameter("transientKey", id);  
          TApplicationDocument d=null;  
          try {
              d = q.getSingleResult();
              System.out.println("AppDocumentTitle  "+d.getAppDocumentTitle());
          } catch (NoResultException e) {
              logger.debug("No result forund for... "+id);
              System.out.println("No result forund for... "+id);
          } catch (Exception e) {
              logger.debug(" Tapp Dao IMple Exception for... "+id);
          }
  return d;
      }
  </code></pre>
  
  <p>What different approach can I take to get this 1% SQL server db's record or how to debug.
  I, just tried to fetch by simple jdbc code but again it does not enter in while loop with some ids even record exist in sqlserver2016. suggest me how to debug.    </p>
  
  <pre><code>public class JdbcSelectDemo {    
      public static void main(String[] args) {      `
          String dbURL = "XXXXXXXXXX";`    
          String username = "XXXXXXX";        String password = "XXXXXXXXX";    
          try (Connection conn = DriverManager.getConnection(dbURL, username, password)) {    
              String sql = "SELECT * FROM TApplicationDocument t where transientKey='115'";    
              System.out.println("Sql to be executed:"+sql);    
              Statement statement = conn.createStatement();    
              ResultSet result = statement.executeQuery(sql);    
              while (result.next()){    
                  System.out.println("in side"+result.getString(1));    
              }    
              System.out.println("End...");    
          } catch (SQLException ex) {    
              ex.printStackTrace();    
          }           
      }    
  }    
  </code></pre>