SQL 'IN' clause fails with Empty Set #1003

Closed
dzag1600 opened this Issue Oct 10, 2014 · 0 comments

Comments

Projects
None yet
2 participants
@dzag1600

I have found that the following code causes an illegal argument exception:

SQLQuery q = ...
RelationalPathBase<?> table = ...
NumberPath col = table.col;
Collection longs = new LinkedList(); //This list is empty
q.where(col.in(longs)).list(table);

AbstractSQLQuery.class - 357: throw new IllegalArgumentException("Expected " + objects.size() + " paths, but got " + constantPaths.size());

In this case, objects.size() = 0 and constantPaths.size() = 1

The prepared statement supplies an empty list ('where table.col in ()') but the setParameters method still expects a parameter for the 'in' list.

@timowest timowest added the bug label Oct 10, 2014

@timowest timowest added this to the 3.5.1 milestone Oct 11, 2014

@timowest timowest closed this in #1002 Oct 14, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment