例如:select pj from Project as pj where pj.name in ( 'a' ,'b','c','d')另外:如果我要实现多个关键字查询,该怎样呢?

解决方案 »

  1.   

    SQL语句应该都支持where in 写法
      

  2.   

    yes
    同意
    大部分关键字都一样
      

  3.   

    我试过,但是不行,我说的是在hql语法,不是sql,
      

  4.   

    6.HQL表达式Syntax
    from DomesticCat cat where cat.name between 'A' and 'B' 
    from DomesticCat cat where cat.name in ('Foo', 'Bar', 'Baz') 
    from DomesticCat cat where cat.name not between 'A' and 'B' 
    from DomesticCat cat where cat.name not in ('Foo', 'Bar', 'Baz') 
      

  5.   

    之所以要这样的功能,是因为解决在网页上用户输入多个关键字查询,例如:a b c(空格分隔),而且输入的关键字是数量不定的,如果用多个and语句连接太麻烦
      

  6.   

    hql 支持,因为QBC支持,如果出错,可能是你有地方写的不对,你仔细看看