This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi everyone, NULL is what confuses me. Especially when I deal with them in Torque. What I thought first was: Criteria.add(MagazinePeer.PUBLISHED, Criteria.ISNULL); Well, this doesn't work. I get "Error near 'NULL'" or runtime error of that sort. In Criteria how to tutorial: criteria.add(MagazinePeer.PUBLISHED, (Object)"PUBLISH IS NULL", Criteria.CUSTOM); This is what they suggest. 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. Do you know how to fix this? It seems impossible and that can be a huge problem to me. If you have any idea or suggestion, please let me know. I'd really appreciate it. Thank you in advance.
Update: I checked criteria.toString() SELECT magazine.MAGAZINE_ID, magazine.SITE, magazine.PUBLISHED, magazine.CREATED, magazine.LAST_MODIFIED, magazine.VISIBLE, magazine.DELETE FROM magazine WHERE magazine.PUBLISHED= IS NOT NULL AND magazine.SITE=10000 ORDER BY magazine.PUBLISHED DESC Well, magazine.PUBLISHED= IS NOT NULL this part is definetely wrong, and I think this is what is causing this problem. So I guess using add(MagazinePeer.PUBLISHED, Criteria.ISNOTNULL); does not work. But in that case, why we have Criteria.ISNOTNULL to begin with? And suggested mathod still gives me compile time error. I am runnint out of time, and I don't want to leave this part like this. I am still looking for a solution. If you know something, please let me know. Thank you