I'm trying to get results from database iterating over two collection as shown below
for (SomeType element1 in List1) {
for (SomeType2 element2 in List2) {
Query query = session.createQuery("from Table where column1 =: element1 and column2 =: element2");
//Operations on list of results
}
}
How can I do something like this with best performance? In my app list1 has 200 elements and list2 around 30 and it takes too much time.