Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 70029 invoked from network); 14 Feb 2006 13:01:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Feb 2006 13:01:01 -0000 Received: (qmail 67959 invoked by uid 500); 14 Feb 2006 13:00:59 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 67785 invoked by uid 500); 14 Feb 2006 13:00:58 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 67764 invoked by uid 99); 14 Feb 2006 13:00:58 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Feb 2006 05:00:58 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [141.211.14.78] (HELO pushingtin.mr.itd.umich.edu) (141.211.14.78) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Feb 2006 05:00:57 -0800 Received: from [141.214.41.77] (host-77.subnet-41.med.umich.edu [141.214.41.77]) by pushingtin.mr.itd.umich.edu (smtp) with ESMTP id k1ED0ZSn016486 for ; Tue, 14 Feb 2006 08:00:36 -0500 Message-ID: <43F1D46D.1080104@umich.edu> Date: Tue, 14 Feb 2006 08:00:29 -0500 From: Henry Lu User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803) X-Accept-Language: en-us, en MIME-Version: 1.0 To: user-java@ibatis.apache.org Subject: abator References: <20060212164737.45447.qmail@web32905.mail.mud.yahoo.com> <16178eb10602131740tf0249ffj66402a66b09d4fd@mail.gmail.com> In-Reply-To: <16178eb10602131740tf0249ffj66402a66b09d4fd@mail.gmail.com> Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I downloaded the abator. How do I run it as standalone application? What is the command? -Henry Clinton Begin wrote: > > Nope. Your solution is fine. > > Cheers, > Clinton > > On 2/12/06, *wang lei* > wrote: > > I am soryy not to agree to your opinions. > You said the xml is simpler than the code. > Now i want to write it in detail. > the code is the following; > int id=... > int min=... > int max=... > //get value from the servlet parameter > IQuery t_AllQuery = this.dao.newQuery(User.class); > if(id>0) > { > IQuery t_Query = this.dao.newQuery(User.class); > t_Query.addEqualTo("equal", new Integer(id)); > > t_AllQuery.addOrCriteria(t_Query); > } > > if(min>0) > { > IQuery t_Query = this.dao.newQuery(User.class); > t_Query.addEqualTo("min", new Integer(min)); > > t_AllQuery.addOrCriteria(t_Query); > } > > if(max<1000000) > { > IQuery t_Query = this.dao.newQuery(User.class); > t_Query.addEqualTo("max", new Integer(max)); > > t_AllQuery.addOrCriteria(t_Query); > } > *Now if the following urls are:* > *example.do?id=12&min=100* > *example.do?min=100* > *example.do?id=12&max=100* > *...* > *...* > 8 urls can listed and 8 sql statements will be executed. > Now may be 8 statement to support this query. > < /DIV> > With the increment of the condition, more sqls will be added,it's > difficult to maintain. > So i can't agree to your opinions of "the dynamic tag is simpler". > And which one is easy to understand, "java code" or xml. > for me,8 xml will be more difficult to maintain and > understand. > If you have a good solution or any idea,just give me, > Thanks for your help. > Addtionaly: > why I need to implement a dao to support ojb,hibernate and > ibatis,even jdbc. > because our company has some products to sell,some time these > products is needed to work with some products from other companies. > So w e must have a common dao to support plantation. >> >> As far as I can tell, the dynamic SQL example you gave is shorter > than >> the Java code you wrote (if you get rid of the redundant CDATA > sections). >> >> That said, I understand your point. A future goal for iBATIS SQL Maps >> (Data Mapper) will be to more easily support ad-hoc queries and >> configuration via the Java API. This will help you get to where > you want >> to be. Unfortunatley it's not available yet. >> >> Cheers, >> Clinton >> >> wang lei wrote: >> >>> At first, thanks for the quick reply from Brandon Goodin. >>> I use java for 3 years. >>> My major work is to provide small base libraries or swing and swt >>> controls for the developers in our company. > >> I don't have much experien ce in big projects. > >>> So my opinions is just based on the small or medium projects. >>> My idea for "design" is simple. I try to make the developer know > how >>> to use my library in 1-3 hours.The simplicity is what i need. >>> I think i understand what Brandon Goodin said. >>> The strength of ibatis is make it easy to use the database's >>> characteristic. >>> If i use ibatis,i should use sql instead of the "Criteria". >>> But i want more simplicity and flexibility. >>> The following is a example. >>> int id=... >>> int min=... >>> int max=... >>> //get value from the servlet parameter >>> IQuery t_AllQuery = this.dao.newQuery(User.class); >>> if(id>0) >>> { >>> IQuery t_Query = this.dao.newQuery (User.class); >>> t_Query.addEqualTo("equal", new Integer(id)); >>> >>> t_AllQuery.addOrCriteria(t_Query); >>> } >>> >>> if(min>0) >>> { >>> IQuery t_Query = this.dao.newQuery(User.class); >>> t_Query.addEqualTo("min", new Integer(min)); >>> >>> t_AllQuery.addOrCriteria(t_Query); >>> } >>> >>> if(max<1000000) >>> { >>> IQuery t_Query = this.dao.newQuery(User.class); >>> t_Query.addEqualTo("max", new Integer(max)); >>> >>> t_AllQuery.addOrCriteria(t_Query); >>> } >>> the java code above is common in out projects. >>> How many sql i need to write. >>> I write one example. >>> >>> >>> >>> >> USER_ID=#equal# >>> ]]> >>> >>> >> USER_ID>#min# >>> ]]> >>> >>> >> USER_ID<#"max"# >>> ]]> >>> >>> >>> >>> >>> >>> >>> If there is no the parameter of "equal". >>> the sql for execution will be >>> "Select USER_ID, USER_NAME, PHOTO, USER_MEMO from DEMO.USER_T". >>> I want to know h ow can i make it easy to handle it. >>> > > ------------------------------------------------------------------------ > ���Ϊ��С�ա��¿��衢�ż��������ݵ������� > > >