title: Cast Map<String,String> to Map<Long,Long>
body: <p>I have the following code in a class which extends <code>LazyDataModel</code> of Primefaces</p>
  
  <pre><code>@Override
      public List&lt;Project&gt; load(int first, int pageSize,
              String sortField, SortOrder sortOrder, Map&lt;String, String&gt; filters) {
  </code></pre>
  
  <p>In the above filters is of type <code>Map&lt;String, String&gt;</code></p>
  
  <p>In my Hibernate Entity class I have the following </p>
  
  <pre><code>private Long projectNo; // with getters and setters
  </code></pre>
  
  <p>and in DAO class I have the following as well to do a search in JSF page and return results</p>
  
  <pre><code>public void getProjects(ProjectQueryData data) { 
  
  Map&lt;String, String&gt; filters = data.getFilters();
  // ....
  ....
  
  String projectNo = filters.get("projectNo");
  List&lt;Predicate&gt; criteria = new ArrayList&lt;Predicate&gt;();
              if (projectNo!= null) {
                  ParameterExpression&lt;String&gt; pexp = cb.parameter(String.class,
                          "projectNo");               
                  Predicate predicate = cb.equal(emp.get(Project_.projectNo),
                          pexp);
                  criteria.add(predicate);
              }
  TypedQuery&lt;Project&gt; q = entityManager.createQuery(c);
  TypedQuery&lt;Long&gt; countquery = entityManager.createQuery(countQ);
  q.setParameter("projectNo", projectNo); // error in this line
  countquery.setParameter("projectNo", projectNo);
  </code></pre>
  
  <p>When I execute the above I am getting the following exception</p>
  
  <pre><code>Hibernate Parameter value [89457] did not match expected type [java.lang.Long]
  </code></pre>
  
  <p>because <code>projectNo</code> is of Long.</p>
  
  <p>My question is how can I cast <code>Map&lt;String,String&gt;</code> to <code>Map&lt;Long,Long&gt;</code> so that I will not get an error in this line <code>q.setParameter("projectNo", projectNo);</code></p>
  
  <p>Any help is highly appreciable.</p>
  
  <p>Thanks</p>