0

I have a list of Date objects. I assigned that list in setParameter ("dates", datesList) and then I did c.createDate IN (:dates). It does not work (query returns 0 results back). How do I do this?

em.createQuery("""
   select u.name, s.description, c.completed, c.input,              c.adjustments, c.taktTime
     from CountEntity c, SkillEntity s, FwmsUserEntity u,   SkillTypeEntity t
       where c.skill = s.id
          AND s.description IN (:skillsList)
          AND c.createDate IN (:dates)
          and t.id=3 and t.id=s.skillType
          and c.fwmsUser = u.id
          """).setParameter("skillsList", skillsList).setParameter("dates", dates).getResultList()
Tony Hinkle
  • 4,706
  • 7
  • 23
  • 35
JBone
  • 1,724
  • 3
  • 20
  • 32
  • Forgot to mention, I am using EntityManager. – JBone Jun 15 '15 at 16:28
  • If it returns a list of 0 elements, then it works. It' just that none of the rows matches with the criteria. – JB Nizet Jun 15 '15 at 17:39
  • I do think so. I am passing an SQL Date in the list like java.sqlDate sqlDate = java.sql.Date.valueOf("2015-06-11") and then putting these sqlDate objects in the datesList. My oracle table has the column Date. What you think I am missing? and thanks for your time. – JBone Jun 15 '15 at 17:48
  • oh yea it worked after I used trunc(c.createDate). 'trunc' is the word. – JBone Jun 15 '15 at 19:02
  • brrr, how could he know that you database have trunc function? – Roman C Jun 15 '15 at 20:02

0 Answers0