Criteria Builder Error

ACF 9.01
CB 3.5
Hibernate ORM

Has anyone ever seen this before?

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?

Erick, can you try this method instead of the one right now. I just have a gut feeling:

// Group expressions together in a single disjunction (A or B or C…)

any function disjunction(required array restrictionValues){

var dj = restrictions.disjunction();

for(var i=1; i LTE ArrayLen(arguments.restrictionValues); i++){

dj.add( arguments.restrictionValues[i] );

}

return dj;

}

Let me know

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

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.

Thanks

Erick Wilson
AngelsEye, Inc
800-690-3740 - Ext. 101
800-690-2089 - Fax
ewilson@angelseyeinc.com
www.angelseyeinc.com

“If you don’t know where you are going, any road will take you there.” – Lewis Carroll, Alice in Wonderland

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.

Thanks

Erick Wilson
AngelsEye, Inc
800-690-3740 - Ext. 101
800-690-2089 - Fax
ewilson@angelseyeinc.com
www.angelseyeinc.com

“If you don’t know where you are going, any road will take you there.” – Lewis Carroll, Alice in Wonderland

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.

Let this be a lesson kiddies...RTM.

Thanks Luis

LOL! Can you post your final criteria query for all to see :slight_smile:

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

You bet!