Re: ThrowawayBean2+DAO Best Practices
beltspeed <[email protected]> Wed, 05 Nov 2003 19:40:58 -0700
| Newsgroups | gmane.comp.web.maverick.general |
|---|---|
| Message-ID | <[email protected]> |
Thanks for the help. I know about Ibatis DAO and Sqlmap, I like it a lot, but I had a feeling that DAO part is tied to Sqlmap and was not sure if you can plug any other DAO implementation such as Hibernate + iBatisDao or any other. I have been playing with Ibatisdb this afternoon and will continue to do so. Thanks, Shrek Ted Husted wrote: > [email protected] wrote: > > Could anybody show me how to use DAO Factory + DAO + ThrowawayBean2. I > > don't know if DAO implementation itself could be a singleton and what > > are best practices. > > Typically, a DAO configuration is exposed as a singleton that you > might access like this: > > AccountDao dao = DaoConfig.getInstance().getAccountDao(); > List list = dao.listByUserName(this.getUserName()); > > If you were using a ThrowawayBean2, then your subclass would include > whatever properties the DAO signature required (shown as > this.getUserName() here). If the signature took a property bean, then > ThrowawayBean2 might implement the appropriate interface, so you'd > have something like: > > AccountDao dao = DaoConfig.getInstance().getAccountDao(); > int value = dao.storeAccount(this); > > iBATIS includes a very nice DAO framework that works with any > persistance strategy, including their own very fine SqlMap framework. > Highly recommended. > > The iBATIS JPetstore3 application is a full-blown example of using > iBATIS with Struts. Essentially, the ThrowawayBean3 combines the > utility of the ActionForm and Actoin into one handy class. > > I'm planning to do a version of JPetstore3 using Maverick, but that > might be some time coming. > > HTH, Ted. > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > Does SourceForge.net help you be more productive? Does it > help you create better code? SHARE THE LOVE, and help us help > YOU! Click Here: http://sourceforge.net/donate/ > [INVALID FOOTER] > ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ [INVALID FOOTER]