java - hibernate restrictions.in with and, how to use? -


i have table below

id, employee_no, survey_no, name 1    test          1         test_name 2    test2         1         test_name2 3    test3         1         test_name3 4    test4         2         test_name4 

how query restriction.in combining below , 1 in statement?

 in[   (if(survey_no==1)  && employee_no== 'test')  ,          (if(survey_no==1)  && employee_no== 'test2') ,         ...    ] 

i think criteria combination want use (btw. easier hibernate entity bean definition instead of table structure):

string[] employeenames = { "test", "test2" }; list<survey> surveys = getsession().createcriteria(survey.class).add(         restrictions.and         (             restrictions.eq("surveynumber", 1),             restrictions.in("employeename", employeenames)         )     ).list(); 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -