EnetityManager为键分配多个值

时间:2015-06-05 19:12:11

标签: hibernate entitymanager

em.createQuery("""
                select s.description, avg(c.taktTime)
                from CountEntity c, SkillEntity s, FwmsUserEntity u, SkillTypeEntity t
                where c.fwmsUser = u.id
                   *AND s.description in (:skillsList)*
                   AND c.skill = s.id
                   AND t.id=6 AND t.id=s.skillType
                   GROUP BY s.description """).setParameter("skillsList", skillsListStr)

.getResultList()

我得到String skills = ('Shelf Count', 'Notion Count', 'Tube Count', '2nd Count')。如何指定此变量'技能'在下面的查询中的s.description?请注意,这些值现在是硬编码的,我想动态传递它们。

em.createQuery("""
                select s.description, avg(c.taktTime)
                from CountEntity c, SkillEntity s, FwmsUserEntity u, SkillTypeEntity t
                where c.fwmsUser = u.id
                   *AND s.description in ('Shelf Count', 'Notion Count', 'Tube Count', '2nd Count')*
                   AND c.skill = s.id
                   AND t.id=6 AND t.id=s.skillType
                   GROUP BY s.description """).getResultList()

0 个答案:

没有答案