db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter S. Hamlen" <pham...@mail.com>
Subject Re: Null value and Criteria
Date Wed, 15 Jan 2003 20:32:57 GMT
The tutorial is correct.

> In Criteria how to tutorial at Jakarta website:
> criteria.add(MagazinePeer.PUBLISHED, (Object)"PUBLISH IS NULL",
> Criteria.CUSTOM);

Keep the cast to (Object).  It's important.

But I think you need to write "PUBLISHED IS NULL" (note that I added the
'ED' to the end of PUBLISH.)

-Peter

On Mon, 2003-01-13 at 22:30, Shin Hashitani wrote:
> The message I posted earlier is messed up at the mail archive page.
> I don't know what I did. Maybe the death march project I am in has caused me
> a severe mental damage.
> I apologize for that.
> Allow me to re-post the same message in normal fashion:
> 
> 
> 
> 
> 
> Torque3.0
> Windows 2000
> Struts 1.1b3
> Tomcat 4.1.18
> PostgreSQL 7.1.4
> 
> 
> 
> I ma having Null value problem.
> 
> What I thought first was:
> Criteria.add(MagazinePeer.PUBLISHED, Criteria.ISNULL);
> would check to see if the value in a particular column is null or not.
> 
> Well, this doesn't work. I get "Error near 'NULL'" or runtime error of that
> sort.
> 
> 
> This is what is suggested. So I trid that. Now the copmile doesn't go
> through.
> 
> "AdminViewMainAction.java": Error #: 304 : method add is ambiguous. method
> add(java.lang.String, java.lang.Object, org.apache.torque.util.SqlEnum)
> class org.apache.torque.util.Criteria and method add(java.lang.String,
> java.lang.String, java.lang.Object) class org.apache.torque.util.Criteria
> exists. column 83, Row 12
> 
> (**The error message came out in Japanese, so it's my translation)
> 
> 
> Removing (Object) casting does let me compile it, but it gives me the
> runtime error. SqlEnum is a package scoped object, so I cannot cast that,
> either.
> 
> But before that,
> this must happen all the time if somebody try to set NULL value to Criteria
> object.
> 
> Why we have Criteria.ISNULL constant to begin with?
> Another questionwould be "Is suggested solution in Torque website is
> obsolete?"
> 
> Thank you in advance.
> 
> 
> 
> Shin Hashitani
> 
> /**
>  *                             q  u  a  n  t  s  I n c.
>  *                         System Engineer
>  *
>  *        Shin Hashitani
>  *  hashitani@quants.co.jp   webmaster@bgedesign.com
>  *                        www.quants.co.jp
>  *     4-13 Kioi-cho, Mader Matsuda Bld. 3F
>  *     Chiyoda, Tokyo 102-0094, Japan
>  *     (phone)+81-3-4333-7440
>  *       (fax)+81-3-4333-7441
> **/
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:turbine-torque-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:turbine-torque-user-help@jakarta.apache.org>
> 



Mime
View raw message