Le lun 14/10/2002 à 17:10, Wendy Smoak a écrit :
> > PeristenceLayer pl = getPerstitenceLayer();
> > pl.save(domainObject);
> > But I'v read that the domain  objects needn't know that are persitent,
> > if you implement a save method that means that ur object know it can be
> > persisted
> 
> In that example, the domainObject still doesn't have to know if/how it's
> being persisted.
> 
> I've implemented the whole DAO pattern, excepting the last bit that makes it
> easy to switch databases since it's highly unlikely that will happen here.
> 
> In 'EditContactAction' I have:
> 
>    DAOFactory udFactory = DAOFactory.getDAOFactory(); 
>    ContactDAO contactDAO = udFactory.getContactDAO();
>    Contact contact = contactDAO.createContact();
> 
> Later, in 'ProcessContactAction' there's:
> 
>    contactDAO.updateContact( contact );
> 
> So while the Actions know that persistence is happening, they have no idea
> how it occurs.
> 

so domainObject doesn't know about the DAO existence, and DAO's
represent ur persistence layer that is called into the struts action.
so if I can implement a generic DAO (that workd for all domain objects)
i will have

GenericDAO gd = // obtain a reference

Contact contact = session.getAttribute("contact");
gd.update(contact);


 

> -- 
> Wendy Smoak
> http://sourceforge.net/projects/unidbtags
-- 
Kevin Viet <[EMAIL PROTECTED]>
ActiVia Networks




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to