Error:
The add method was not found.
Either there are no methods with the specified method name and
argument types or the add method is overloaded with argument types
that ColdFusion cannot decipher reliably. ColdFusion found 0 methods
that match the provided arguments. If this is a Java object and you
verified that the method exists, use the javacast function to reduce
ambiguity.
It is thrown from line 201 of /coldbox/system/orm/hibernate/criterion/
Restrictions.cfc
It is produced when I try to run the following code in a function...
var c = newCriteria();
var disjArray = [];
ArrayAppend(disjArray,c.ilike('contactFirstName','%' & arguments.name
& '%'));
ArrayAppend(disjArray,c.ilike('contactLastName','%' & arguments.name &
'%'));
c.isEQ('contactSalespersonUserID',javacast('short',session.userId));
c.disjunction(disjArray);
var results = c.list();
return results;
Obviously if you look at line 201, you will see the disjunction method
is trying to use the add() method, but I'm not sure why the add()
method isn't being seen. Thoughts anyone?
Luis,
I just left the office to prepare for an out of town funeral this weekend. I will be more than happy to try it Monday and let you know what I find.
I replaced the disjunction function as you requested but the result is still the same.
I thought it may have to do with the data being passed in so I tried to javacast my data as a string (ie. because it’s a string of ‘%bar%’) but that didn’t work.
I’ve tried to javacast it to all the types I can find documentation for and nothing works so I’m not sure why it’s doing it.
My data fields are varchar(20) so I don’t see that being an issue (that I know of).
It could be ACF as I have found a few other bugs that are specific (and confirmed) to ACF as they don’t cause problems in Railo.
Okay, here is the deal...User Error.
Yeah, I started reading the docs and noticed that inside the
restriction examples it was showing c.restrictions.eq(yada, yada) and
then I started working backwards and tried that in my code and WAH-
LAH. So if you go back up and look at my original code, you'll notice
that I was not doing c.restrictions.ilike(), but instead was doing
c.ilike() in my disjunction. This was the cause of a method not being
found.