java - How to do addAll from multiple sql result in hibernate? -
i'm running sql seperately, because hibernate doesn't support "union". how addall results.
public list<product> findlist(string pid) { list <product> result1 ; list <product> result2; object[] obj = {pid}; result1.add(findallbyquery(product_division1,obj)); result1.add(findallbyquery(product_division2,obj)); return result1.addall(result1); } product_division1 = "query"; product_division2 = "query";
please advise.
return result1.addall(result1);
doesn't make sense me, it's adding content of itself. 'add' method supposed used add 1 element only. list uninitialized.
what you're trying achieve sounds straight forward, need query each collection , combine it
list <product> result = findallbyquery(product_division1,obj); result.addall(findallbyquery(product_division2,obj) return result;
Comments
Post a Comment