title: JPA JPQL query returning null
body: <p>I have the following query, trying to fetch Employee entity objects using part of the @Embeddable id class:</p>
  
  <pre><code>public List&lt;EmployeeTask&gt; getEmployeeById(){
                      return em.createQuery("SELECT a FROM EmployeeTask a where a.id.empcode = '5091'" ).getResultList();
  </code></pre>
  
  <p>The code above returns null on my jsf page. But when i change this to :</p>
  
  <pre><code>public List&lt;EmployeeTask&gt; getEmployeeById(){
                          return em.createQuery("SELECT a FROM EmployeeTask a where a.id.empcode like '5091'" ).getResultList();
  </code></pre>
  
  <p>again it returns null. But when i try:</p>
  
  <pre><code>public List&lt;EmployeeTask&gt; getEmployeeById(){
                          return em.createQuery("SELECT a FROM EmployeeTask a where a.id.empcode like '5091%'" ).getResultList();
  
   }
  </code></pre>
  
  <p>it returns the contents of the Entity object as expected... Anyone knows why this happens?</p>
  
  <p>More details on what i need to do: the EmployeeTask table contains all tasks performed by the employee. EmployeeTaskPK is string empcode, string taskcode, date since. I want to fetch all records for a given empcode in my Entity instance and list them on a jsf datatable.</p>
  
  <p>Thank you,</p>