Thanks for the reply! It now compiles but I still get multiple values.
Daniel Quoting Raphael Mankin <[EMAIL PROTECTED]>: > IIRC you have to cast the 2nd argument of add() to Object.I have tripped over > this one as well. The methods in the class are infelicitously overloaded. > > > > On 15-Jul-2005 [EMAIL PROTECTED] wrote: > > > > Thanks for the reply Alvaro! > > > > If I don't use a criterion, I get another extra weird error written here > > below: > > java.lang.Error: Unresolved compilation problem: > > The method add(String, Object, SqlEnum) is ambiguous for the type Criteria > > > > So it has a problem with: > > criteria.add(AreaPeer.POSTCODE, "NULL", Criteria.NOT_EQUAL); > > > > If anyone has any clues or hints or anything useful, I'd be very thankful, > > > > Daniel > > > > Quoting Alvaro Coronel <[EMAIL PROTECTED]>: > > > >> Well... it might have nothing to do with it but for me it is just weird to > >> use a Criterion there. > >> > >> What about this? > >> > >> criteria = new Criteria(); > >> criteria.add(AreaPeer.POSTCODE, "NULL", Criteria.NOT_EQUAL); > >> criteria.setDistinct(); > >> > >> If this selects distinct, you can go on to adding the order > >> > >> criteria.addAscendingOrderByColumn(AreaPeer.POSTCODE) > >> > >> Good luck! > >> > >> Álvaro. > >> > >> [EMAIL PROTECTED] wrote: > >> > >> Hi, > >> > >> I have a very strange problem with Torque. I'm building a website using > >> struts > >> where on a certain page, a form is populated by having access to the > >> database > >> (MySql) using Torque. So in my ActionForm, I have the following to > populate > >> an > >> option collection. > >> > >> criteria = new Criteria(); > >> > >> // No postcode with a null value > >> Criteria.Criterion notNullPost = criteria.getNewCriterion > >> (AreaPeer.POSTCODE, "NULL", Criteria.NOT_EQUAL); > >> criteria.add(notNullPost); > >> > >> // Order the list > >> criteria.addAscendingOrderByColumn(AreaPeer.POSTCODE); > >> > >> // Show only distinct > >> criteria.setDistinct(); > >> > >> System.out.println(criteria.toString()); > >> > >> List post = AreaPeer.doSelect(criteria); > >> request.getSession().setAttribute("add_postcode_letters", post); > >> > >> The problem is that the list I get on the page is a list with multiple > >> values > >> as > >> if the setDistinct() wouldn't have worked. > >> > >> Yet, when I query the database from the MySql command line using the query > I > >> got > >> from this bit of code: System.out.println(criteria.toString()); > >> It works under MySql... Here's the sql query: > >> mysql> SELECT DISTINCT area.POSTCODE FROM area WHERE area.POSTCODE<>'NULL' > >> ORDER > >> BY area.POSTCODE ASC; > >> > >> The table is called area and has 5 columns including the postcode column. > >> I'm using Torque 3.1, Tomcat v5 and MySql v4.1 > >> > >> If anyone has any clues or hints or anything useful, I'd be very thankful, > >> > >> Daniel > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > >> __________________________________________________ > >> Do You Yahoo!? > >> Tired of spam? Yahoo! Mail has the best spam protection around > >> http://mail.yahoo.com > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > -- > Lead us not into temptation; we > can find our own way. > > > Raphael Mankin > ---------------------------------- > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]