I managed to solve the problem by doing precisely what you are doing. It appears to only happen when using pre-built Strings. String instances don't give this issue.
Thanks for your help. -----Original Message----- From: Moore, Scott R. [mailto:[EMAIL PROTECTED]] Sent: Friday, January 17, 2003 3:01 PM To: 'Turbine Torque Users List' Subject: RE: Trouble casting objects -- possible java issue? Justin, I have almost the exact same situation, only coded slightly differently ("name" is a String that is passed into a function that has the following code): Criteria crit = new Criteria(); String partialName = "%" + name + "%"; crit.add(AtsFormPeer.FULLNAME, (Object)partialName, Criteria.LIKE); I would think it doesn't matter whether you build declare the String before or inside the call to .add(), but maybe it does, since the above code hasn't given me any problems. HTH, Scott Moore. -----Original Message----- From: Campbell, Justin [mailto:[EMAIL PROTECTED]] Sent: Friday, January 17, 2003 2:01 PM To: '[EMAIL PROTECTED]' Subject: Trouble casting objects -- possible java issue? I'm using Torque 3.0 and attempting to setup a criteria using a "LIKE" comparator. I setup my Criteria object as such: Criteria crit = new Criteria(); crit.add(CompanyInfoPeer.COMPANYNAME, (Object)"%foobar%", Criteria.LIKE); However, this refuses to compile, citing that this is an ambiguous call to one of two methods "add" (one that accepts "String, String, SqlEnum" and one that accepts "String, Object, SqlEnum" -- I am attempting to call the latter). Clearly, the compiler is ignoring my "upward cast" to Object from String. So far, the only viable solution I've found is to retrieve the string "%foobar%" as a CharSequence (actually an instance of String in this case). Am I missing something here? Is this an issue with Torque, my code or a genuine issue with the java compiler? Any help is greatly appreciated. Thanks in advance. Justin Campbell Project Technical Lead Profile Systems, Inc. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
