You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Martin Naskovski <mn...@san.rr.com> on 2003/07/02 03:27:42 UTC
Re: Representing a 1->m relationship. Any suggestions to the best ap proach?
Have you checked out Hibernate? It does a lot of what you ask for :). (and
then some). Plus it's LGPL.
Martin
Tuesday, July 1, 2003, 5:31:40 PM, you wrote:
SM> Hi
SM> I am struggling with the best approach to take with my first Struts
SM> application and wondered if I could get some voices of experience.
I have a 1->>m relationship (Supplier -> Products) that I wish to represent
SM> in a maintenance application.
SM> You can Add or Edit a Supplier, and then within this Add or Edit you can Add
SM> or Edit Products.
SM> My persistence layer provides a Supplier Data Transfer Object(DTO)
SM> representing the Supplier->Products (The Supplier holds a Collection of
SM> Product DTO's).
SM> At the moment I have ActionForm for Supplier held in session scope
SM> containing a collection of Product ActionForms. Depending on Add or Edit
SM> these are populated from the Supplier DTO.
SM> When a Save is finally executed I create a Supplier DTO and populate it from
SM> the Supplier ActionForm and collection of Product ActionForms. The DTO is
SM> passed to the persistence layer.
SM> I still have logic in the Action classes that I do not like, for example the
SM> Save determines whether to call insert() or update() on my persistence
SM> layer. I think I need a Workflow type class where a method Save() will
SM> determine whether to call insert() or update().
SM> So, any comments of my current approach?
SM> Suggestions for improvements?
SM> Thanks
SM> Shane
SM> Shane Mingins
SM> Analyst Programmer
SM> Assure NZ Ltd
SM> Ph 644 494 2522
SM> ---------------------------------------------------------------------
SM> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
SM> For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org