One solution I used would be to put some dummy value in the list along with your input, to ensure that it will never be empty. Of course, you can only do this if you can select a dummy value.
If your input list is typeNamesOrig :
List<String> typeNames = new ArrayList<String>(typeNamesOrig); typeNames.add("valueThatDoesNotExistForSure"); query.setParameterList("typeNames",typeNames);
source share