(Apologies for replying in the wrong forum, but I can't seem to comment
on the bug in Scarab)

Rags,

I believe this is not a bug (or at least there is a simple workaround). 
You simply have to specify (through casting) which method you want to
use. The easiest is to cast the sqlToDate() as an Object rather than as
a String.  There's an example of this in the Criteria HowTo (see "Using
Custom Criteria" section.)

The corrected line would look like:
criteria.and(GamePeer.DATE,(Object)(sqlFromDate.toString()),
                         Criteria.GREATER_THAN);

I believe you could write it even simpler with:

java.util.Date theDate = new Date();
criteria.and(GamePeer.DATE, theDate, Criteria.GREATER_THAN);

We use this all the time in our code.

-Peter


On Mon, 2002-10-14 at 21:20, Rags Srinivasan wrote:
> You can view the issue detail at the following URL:
> <http://nagoya.apache.org/scarab/issues/id/TRQS25>
> 
> Type :        Defect
> Issue Id :    TRQS25
> Reported by: Rags Srinivasan
>              rags - ([EMAIL PROTECTED])
> 
> Details:
> 
> Summary: Criteria.and() function compiler ambigutiy error
> Description: Here is my usage.
> java.sql.Date sqlToDate = new java.sql.Date(
>                    new 
>GregorianCalendar(year,month,nextDayOfMonth).getTime().getTime());
>               criteria.and(GamePeer.DATE,(String)sqlFromDate.toString(),
>                         Criteria.GREATER_THAN);
> 
> This causes compiler error:
> [javac] 
>/home/rags/projects/football/db_src/java/com/unpapier/football/TorqueServiceImpl.java:177:
> reference to and is ambiguous, both method 
>and(java.lang.String,java.lang.Object,org.apache.torque.util.SqlEnum) in 
>org.apache.torque.util.Criteria and method 
>and(java.lang.String,java.lang.String,java.lang.Object) in 
>org.apache.torque.util.Criteria match
>     [javac]             criteria.and(GamePeer.DATE,(String)sqlFromDate.toString(),
> 
> 
> Status: New
> Database: MySQL
> Operating system: Linux
> Priority: Undecided
> 
> 
> --
> 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]>

Reply via email to