Read Rick's ibatis tutorial, it covers DAO quite well:

http://reumann.net/struts/ibatisLesson1.do


On Sun, 30 Jan 2005 09:57:03 -0700, Wendy Smoak <[EMAIL PROTECTED]> wrote:
> From: "Brandon Mercer" <[EMAIL PROTECTED]>
> > They both talk about accessing information from a database and DAO and DTO
> > and all that jazz and quite frankly I don't understand it.  :-P
> 
> This should explain the DAO and DTO references:
> http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html
> 
> This is the pattern I used to write my data access layer.  But I'm unlucky
> in that my database is weird and SQL/JDBC doesn't work well with it.  It has
> a proprietary API, so I had to write all the DAO classes myself.  It looks
> like you have a normal SQL database, so you could use one of the persistence
> frameworks like Hibernate if you wanted.
> 
> What you've got so far looks pretty good!  From your intro I expected to see
> JDBC in the Action code, but you have it separated out. :)
> 
> Is 'BillPayForm'  Struts form bean?  If so, [IMO] you should get it out of
> your BillpayData class.  (The data access classes shouldn't know about
> Struts or HTTPRequests.)  You might also consider having the data access
> class "know" how to get its own connection rather than passing one in.  I
> use a static Factory, but you can [I hear] configure a Datasource in the
> Servlet container and then any class should be able to look it up [JNDI??].
> 
> The magic of BeanUtils looks like this:
> 
>    Person person = personDAO.read( "012345" );
>     BeanUtils.copyProperties( form, person );
> 
> That prepopulates the form for display.
> When the user has submitted his changes, you go back the other way:
> 
>    BeanUtils.copyProperties( person, form );
>     personDAO.update( person );
> 
> --
> Wendy Smoak 
> 
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to