Hi, I'm sorry, I there are something wrong with my eye, I was misunderstand the source. Thank you very much.
Now, I want to use build a little complex join query condition. I have two tables: Student & Teacher, and I want to do select like: select student.* from student , teacher where (student.teacher_id=teacher.id and teacher.name like 'Mike%') or student.age > 12; How to build the Criteria? when I create Criterias for the following 2 sentences, but they generate the SAME result: 1. select student.* from student , teacher where (student.teacher_id=teacher.id and teacher.name like 'Mike%') or student.age = 12; c.addJoin(StudentPeer.teacher_id, TeacherPeer.id ); c.and(TeacherPeer.NAME, 'Mike%', Criteria.LIKE); c.or(StudentPeer.AGE, 12); 2. select student.* from student , teacher where (student.teacher_id=teacher.id and teacher.name like 'Mike%') AND student.age = 12; c.addJoin(StudentPeer.teacher_id, TeacherPeer.id ); c.and(TeacherPeer.NAME, 'Mike%', Criteria.LIKE); c.and(StudentPeer.AGE, 12); What's the matter? Can Torque apply "or" in different columns? Thanks. Annie ps: where is the new torque mailling list? how to register? ----- Original Message ----- From: "Weaver, Scott" <[EMAIL PROTECTED]> To: "'Turbine Users List'" <[EMAIL PROTECTED]> Sent: Thursday, April 04, 2002 2:42 PM Subject: RE: Strange Error!! urgent! still error! > > > -------------------------------------------------------------------------- -- > "In my heart of hearts, I'm an engineer, and what makes me happy is building > > something that works and having someone use it. That's cool." > > - James Gosling, Father of Java > -------------------------------------------------------------------------- -- > > > Should I delete the function from org.apache.torque.util.Criteria.java > > public Criteria add ( String table, > > String column, > > Object value ) > No. There is no need to get all crazy and start changing source. Just cast > your String as an Object, and all should be well. > > c.add(SoOrderHeadersPeer.CUSTOMER_NAME, > (Object)searchForm.getCustomerName(), Criteria.LIKE); > > Scott > > > > > -----Original Message----- > > From: Annie Zhang [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, April 04, 2002 5:25 PM > > To: Turbine Users List > > Subject: Re: Strange Error!! urgent! still error! > > > > > > Hi Weaver > > > > Thank you for your reply. I have restored all the Torque java > > files. And use > > SqlEnum.LIKE instead of Criteria.LIKE, JBuilder still report > > ambiguous > > error: > > > > c.add(SoOrderHeadersPeer.CUSTOMER_NAME, searchForm.getCustomerName(), > > Criteria.LIKE); > > > > > > "ViewOrdersAction.java": Error #: 304 : reference to add is > > ambiguous; both > > method add(java.lang.String, java.lang.Object, > > org.apache.torque.util.SqlEnum) in class > > org.apache.torque.util.Criteria and > > method add(java.lang.String, java.lang.String, > > java.lang.Object) in class > > org.apache.torque.util.Criteria match at line 117, column 22 > > > > Should I delete the function from org.apache.torque.util.Criteria.java > > public Criteria add ( String table, > > String column, > > Object value ) > > > > Annie > > > > ----- Original Message ----- > > From: "Weaver, Scott" <[EMAIL PROTECTED]> > > To: "'Turbine Users List'" <[EMAIL PROTECTED]> > > Sent: Thursday, April 04, 2002 1:54 PM > > Subject: RE: Strange Error!! urgent! > > > > > > > Why are you trying to access SqlEnum.LIKE? Just use what > > is given to you > > by > > > the Criteria class. > > > > > > c.add(SoOrderHeadersPeer.CUSTOMER_NAME, > > searchForm.getCustomerName(), > > > Criteria.LIKE); > > > > > > > > > p.s. > > > > > > For future reference, Torque questions should be posted to the new > > > torque-user and/or torque-dev mailing lists. > > > > > > > > > Scott > > > > > > > > > > > > > > > > -----Original Message----- > > > > From: Annie Zhang [mailto:[EMAIL PROTECTED]] > > > > Sent: Thursday, April 04, 2002 3:44 PM > > > > To: Turbine Users List > > > > Subject: Strange Error!! urgent! > > > > > > > > > > > > Hi, I meet a strange error while using Criteria: > > > > > > > > I want to apply " CUSTOMER_NAME like ......" as a condition > > > > in query. My code like this: > > > > > > > > Criteria c = new Criteria(); > > > > c.add(SoOrderHeadersPeer.CUSTOMER_NAME, > > > > searchForm.getCustomerName(), SqlEnum.LIKE); > > > > > > > > 1. > > > > The compiler report a error: > > > > > > > > "XXXXX.java": Error #: 307 : class > > > > org.apache.torque.util.SqlEnum is not public in package > > > > org.apache.torque.util; cannot be accessed from outside > > > > package at line 123, column 118 > > > > > > > > 2. > > > > I checked org.apache.torque.util.SqlEnum.java, and add > > > > "public" in the class definition. > > > > > > > > Another strange error occured: > > > > > > > > "XXXXXX.java": Error #: 304 : reference to add is ambiguous; > > > > both method add(java.lang.String, java.lang.Object, > > > > org.apache.torque.util.SqlEnum) in class > > > > org.apache.torque.util.Criteria and method > > > > add(java.lang.String, java.lang.String, java.lang.Object) in > > > > class org.apache.torque.util.Criteria match at line 123, column 22 > > > > > > > > 3. > > > > Then, I change my code like this: > > > > > > > > c.add((String)(SoOrderHeadersPeer.ORDER_NUMBER), > > > > (String)(searchForm.getOrderNumber()), (SqlEnum)(SqlEnum.LIKE)); > > > > > > > > The error still exist. > > > > > > > > 4. > > > > Then, I delete the function from > > org.apache.torque.util.Criteria.java > > > > public Criteria add ( String table, > > > > String column, > > > > Object value ) > > > > > > > > It's Ok now. Strange???? > > > > > > > > > > > > Very Strange! > > > > What's the problem?? Can you give me some light about this? > > > > > > > > Thanks > > > > > > > > > > > > Annie > > > > > > > > > > > > > -- > > 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]>
