db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Moore, Scott R." <MOOR...@SEC.GOV>
Subject RE: Trouble casting objects -- possible java issue?
Date Fri, 17 Jan 2003 20:00:36 GMT

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

    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.

Scott Moore.

-----Original Message-----
From: Campbell, Justin [mailto:jcampbell@profilesys.com]
Sent: Friday, January 17, 2003 2:01 PM
To: 'turbine-torque-user@jakarta.apache.org'
Subject: Trouble casting objects -- possible java issue?

I'm using Torque 3.0 and attempting to setup a criteria using a "LIKE"

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

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:
For additional commands, e-mail:

View raw message