openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Boblitz John <>
Subject AW: illogical java.lang.IllegalArgumentException: Input parameter "ids" is empty
Date Tue, 23 Aug 2011 15:43:41 GMT
> -----Ursprüngliche Nachricht-----
> Von: Henno Vermeulen [] 
> Gesendet: Dienstag, 23. August 2011 15:29
> An: ''
> Betreff: illogical java.lang.IllegalArgumentException: Input 
> parameter "ids" is empty
> I have a query that goes like "SELECT, ... FROM ... 
> WHERE IN :ids". Parameter ids is a list of ids. When it 
> is empty and I execute the query, OpenJPA throws 
> java.lang.IllegalArgumentException: Input parameter "ids" is empty.
> Why not just return an empty list? I feel this is much like 
> iterating over an empty Collection: by not throwing an 
> exception you get less complex code than when you have to 
> write an if statement to handle empty collections.
> Regards,
> Henno Vermeulen
> Huize Molenaar


I would think it has a lot to do with the fact that the underlying
SQL cant be executed!  The SQL IN clause requires a list of values 
and if they are not provided, SQL will throw the error.

Further, an empty list is indicative of a query which found no entries
satisfying a given criteria (and implicitly, that the criteria were valid.)

The exception indicates that the criteria itself are invalid.

Anyway, just my 2 pence ...




Who is General Failure, and why is he reading my hard disk?

View raw message