I spent few days debugging problem; the following code not work

long[] organizationIds = new long[organizations.size()];
userParams.put("usersGroups", organizationIds);

but this worked

Long[] organizationIds = new Long[organizations.size()];

why? there’s code check snippet along the line:

if (params.get("usersGroups") instanceof Long)

Although compiler will allow use long instead of Long and vice visa via autobox, it doesn’t happen with instanceof operator.