0 Replies Latest reply on Feb 11, 2008 8:43 AM by baspet

    hql error using in clause with Session instead of EntityMana

    baspet

      Hi,

      i have a strange exception executing code below:

      @PersistenceContext EntityManager em;
      ...
      
      Session session = (Session) em.getDelegate();
      List<Integer> aList = new ArrayList<Integer>();
      aList.add(1);
      aList.add(2);
      List results = session.createQuery("from MyTable where myField in (:ids)").setParameter("ids", aList).list();
      

      executing above query results in ClassCastException at IntegerType class.
      But, if i use em instead of session, query executed successfully!

      List results = em.createQuery("from MyTable where myField in (:ids)").setParameter("ids", aList).getResultList();
      


      I'm not sure if this is a seam bug but any help would be welcomed.

      Thanks,
      V.