title: Java throws "PersistenceException:SQLGrammarException: Could not extract resultset"
body: <p>I am calling a function that tries to check if a particular record exist in my table in MYSQL.</p>
  
  <p>The function:</p>
  
  <pre><code> public String get_value(long nodeid,String ts) {
          try {
              String sql="Select URL FROM urllink WHERE URL="+"'f0='"+nodeid+"'&amp;ts='"+ts;
  
              em.createNativeQuery(sql).getSingleResult();
              if (em == null) {
                  throw new Exception("could not found URL object.");
              }
            //  return 1;
  
          } catch (Exception e) {
              e.printStackTrace();
  
  
  
          }
         return null;
      }
  </code></pre>
  
  <p>When it goes to <code>getSingleResult()</code>,it throws a:</p>
  
  <pre><code>PersistenceException:SQLGrammarException: Could not extract resultset
  </code></pre>
  
  <p>I checked my SQL query and it seems fine so I am not sure what went wrong.</p>
  
  <h2>Edit</h2>
  
  <p>The caller function:</p>
  
  <pre><code>String v=fileFacade1.get_value(fileID,date);
  
    if(v !=null ){ 
  
  // if the URL column contains the result, do something.
  
  
  }
  </code></pre>