Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 38666 invoked from network); 3 Mar 2008 13:56:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Mar 2008 13:56:05 -0000 Received: (qmail 46002 invoked by uid 500); 3 Mar 2008 13:56:00 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 45355 invoked by uid 500); 3 Mar 2008 13:55:59 -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 45344 invoked by uid 99); 3 Mar 2008 13:55:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Mar 2008 05:55:59 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jeffgbutler@gmail.com designates 72.14.204.239 as permitted sender) Received: from [72.14.204.239] (HELO qb-out-0506.google.com) (72.14.204.239) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Mar 2008 13:55:24 +0000 Received: by qb-out-0506.google.com with SMTP id c7so8269659qbc.16 for ; Mon, 03 Mar 2008 05:55:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=F1A7m7ToCLqOMue+nkMhWa4Xztt71sZFVfual9z8fvw=; b=m9hRbEpY1BjFAbjOkEMcUNz3ACGIaqjL7GQrRUdGa3Xvlh3wEHES2J3ub5WnLBnaF6kmnN/n+2RGxofk1uGyIl9Tw1Y/llIOWCR7OI0yCcSYi0YCuVxHmNOBRDoO9iJGDh5+KvhnLBPjYB9BD45UQDi/zFLAHZypRP2tOlcJdsU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=KNhYKuy5iJcIUwbW8ekPejOGGxz0XdFt7lD+J30r4cDdjlpAxtWL4X++BPNY3xbyifmQ2BwwoSF7mmDu0CQkxbJLTSMkM42z27L20EUKfnwaFVLsNs3NhHBPEo5OSK5S1QG0GJnAMDC8caiHikk2ttdZ0qaMnOYJJ2AWL97al28= Received: by 10.114.204.7 with SMTP id b7mr2964023wag.124.1204552533225; Mon, 03 Mar 2008 05:55:33 -0800 (PST) Received: by 10.114.111.3 with HTTP; Mon, 3 Mar 2008 05:55:33 -0800 (PST) Message-ID: Date: Mon, 3 Mar 2008 07:55:33 -0600 From: "Jeff Butler" To: user-java@ibatis.apache.org Subject: Re: [SPAM] Re: iBATIS for swing application In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_6076_31104236.1204552533229" References: X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_6076_31104236.1204552533229 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline The SVN version is very stable and has a few extra features (it now generates countByExample and updateByExample methods) , but the 1.0 version should be fine too. I think you could use either. Jeff Butler On Mon, Mar 3, 2008 at 2:02 AM, pieter.baele@pandora.be < pieter.baele@telenet.be> wrote: > Jeff, > > It helps a lot, I didn't knew abator also can generate a generic DAO. > Is it recommended to use the svn version? > > Thx! > Pieter > > > > >----- Oorspronkelijk bericht ----- > >Van: Jeff Butler [mailto:jeffgbutler@gmail.com] > >Verzonden: maandag, maart 3, 2008 02:12 AM > >Aan: user-java@ibatis.apache.org > >Onderwerp: [SPAM] Re: iBATIS for swing application > > > >Here's a way to use the generic DAOs built by Abator (I think this is the > >easiest way to do it if you're not using Spring): > > > >1. Use Abator to generate generic DAOs with the GENERIC-CI DAO generator > >2. Write an SqlMapConfig.xml file listing all the SqlMap.xml files > generated > >by Abator (theres an example in the Abator documentation) > >3. Write a Singleton factory for DAOs the DAOs: > > > >public class DAOFactory { > > > > private static DAOFactory instance = new DAOFactory(); > > public static DAOFactory getInstance() { > > return instance; > > } > > > > private SqlMapClient sqlMap; > > private MyDao myDao; > > > > private DAOFactory () { > > String resource = "com/mycompany/SqlMapConfig.xml"; > > Reader reader = Resources.getResourceAsReader(resource); > > sqlMap = SqlMapClientBuilder.buildSqlMap(reader); > > } > > > > public MyDao getMyDao() { > > if (myDao == null) { > > myDao = new MyDaoImpl(sqlMap); > > } > > return myDao; > > } > >} > > > >You can repeat the MyDao method for every DAO generated by Abator. > > > >3. Use this factory anywhere in your Swing app like this: > > > >MyDao myDao = DAOFactory.getInstance().getMyDao(); > >myDao.insert(myObject); > > > >etc. > > > >Hope that helps - > > > >Jeff Butler > > > > > > > > > > > > > >On Sun, Mar 2, 2008 at 1:09 PM, pieter.baele@pandora.be < > >pieter.baele@telenet.be> wrote: > > > >> Hello, > >> > >> I am a student (college university) working on a part of a fictive > project > >> management software system. > >> > >> We received a database dll scheme, so Hibernate was not really an > option. > >> It's also a very short project (8 weeks) so iBATIS is definitely a > better > >> solution. > >> (shorter learning curve) > >> > >> I've bought iBATIS in action and generated Java Beans and sqlmaps with > >> abator. > >> > >> But now I am stuck. I need some sort of Factory/Facade/Controller for > the > >> sqlMaps, but how to code these? > >> It's a desktop app, so isn't the (Spring) DAO overkill??? (I also don't > >> have enough time...) > >> Is it necessary to use a DAO? Is the iBATIS DAO out-of-date because it > >> isn't under development anymore? > >> > >> I don't like the MVC solution we've seen in the Java lessons - manually > >> writing a Connection class, and Mapper classes (Prepared and Callable > >> statements) > >> ...but I also don't really know how to fill in the gap between Swing > >> (view) and the sqlmaps + beans... > >> > >> Any help is greatly appreciated. > >> > >> A desperate ;-) student > >> Greeting, PieterB > >> > >> > >> > >> > >> > > > > > ------=_Part_6076_31104236.1204552533229 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
The SVN version is very stable and has a few extra features (it now generates countByExample and updateByExample methods) , but the 1.0 version should be fine too.  I think you could use either.
 
Jeff Butler

On Mon, Mar 3, 2008 at 2:02 AM, pieter.baele@pandora.be <pieter.baele@telenet.be> wrote:
Jeff,

It helps a lot, I didn't knew abator also can generate a generic DAO.
Is it recommended to use the svn version?

Thx!
Pieter



>----- Oorspronkelijk bericht -----
>Van: Jeff Butler [mailto:jeffgbutler@gmail.com]
>Verzonden: maandag, maart 3, 2008 02:12 AM
>Aan: user-java@ibatis.apache.org
>Onderwerp: [SPAM] Re: iBATIS for swing application
>
>Here's a way to use the generic DAOs built by Abator (I think this is the
>easiest way to do it if you're not using Spring):
>
>1. Use Abator to generate generic DAOs with the GENERIC-CI DAO generator
>2. Write an SqlMapConfig.xml file listing all the SqlMap.xml files generated
>by Abator (theres an example in the Abator documentation)
>3. Write a Singleton factory for DAOs the DAOs:
>
>public class DAOFactory {
>
>  private static DAOFactory instance = new DAOFactory();
>  public static DAOFactory getInstance() {
>    return instance;
>  }
>
>  private SqlMapClient sqlMap;
>  private MyDao myDao;
>
>  private DAOFactory () {
>    String resource = "com/mycompany/SqlMapConfig.xml";
>    Reader reader = Resources.getResourceAsReader(resource);
>    sqlMap = SqlMapClientBuilder.buildSqlMap(reader);
>  }
>
>  public MyDao getMyDao() {
>    if (myDao == null) {
>      myDao = new MyDaoImpl(sqlMap);
>    }
>    return myDao;
>  }
>}
>
>You can repeat the MyDao method for every DAO generated by Abator.
>
>3. Use this factory anywhere in your Swing app like this:
>
>MyDao myDao = DAOFactory.getInstance().getMyDao();
>myDao.insert(myObject);
>
>etc.
>
>Hope that helps -
>
>Jeff Butler
>
>
>
>
>
>
>On Sun, Mar 2, 2008 at 1:09 PM, pieter.baele@pandora.be <
>pieter.baele@telenet.be> wrote:
>
>> Hello,
>>
>> I am a student (college university) working on a part of a fictive project
>> management software system.
>>
>> We received a database dll scheme, so Hibernate was not really an option.
>> It's also a very short project (8 weeks) so iBATIS is definitely a better
>> solution.
>> (shorter learning curve)
>>
>> I've bought iBATIS in action and generated Java Beans and sqlmaps with
>> abator.
>>
>> But now I am stuck. I need some sort of Factory/Facade/Controller for the
>> sqlMaps, but how to code these?
>> It's a desktop app, so isn't the (Spring) DAO overkill??? (I also don't
>> have enough time...)
>> Is it necessary to use a DAO? Is the iBATIS DAO out-of-date because it
>> isn't under development anymore?
>>
>> I don't like the MVC solution we've seen in the Java lessons - manually
>> writing a Connection class, and Mapper classes (Prepared and Callable
>> statements)
>> ...but I also don't really know how to fill in the gap between Swing
>> (view) and the sqlmaps + beans...
>>
>> Any help is greatly appreciated.
>>
>> A desperate ;-) student
>> Greeting, PieterB
>>
>>
>>
>>
>>
>



------=_Part_6076_31104236.1204552533229--