You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by "Campbell, Justin" <jc...@profilesys.com> on 2003/01/17 20:01:22 UTC

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.