Hi Vlad,
What ever results in the least/simplest/fastest code!
The way I look at is that you have a special 'ViewSupport' layer in your app
that provides sorted copies of the data for presentation. This is seperate from
the main business logic. You can supply the data as maps/sets/lists normalised
or not. The 'rules' of MVC are a bit irrelevant here. You are more concerned
with performance & simplicity. The data here is 'snap-shot' copies of the data,
not really the main data model & isn't updated. The formats of data returned
are deterrmined by the requirements of the view.
I'm speaking here of database/business systems other types may be very
different.
Keith.


--- Vladimir Levin <[EMAIL PROTECTED]> wrote:
> Hi, I have a basic design-level question to ask of those who are
> using the struts framework. The question concerns how data from
> the database get retrieved into the 'web-tier' beans
> of the application when table joins are involved.
> 
> One approach is to nest objects. e.g. say we want to display
> all the BANANA records belonging to each MONKEY in our database.
> 
> we can create a Monkey object and assign a list of Banana objects
> to each Monkey.
> 
> public class Monkey {
>   private String name;
>   private List bananas; //type of objects in list is Banana
> 
>   public String getName() { return name; }
>   public void setName(String name) { this.name = name; }
>   public List getBananas() { return bananas; }
>   public void setBananas(List bananas) { this.bananas = bananas; }
> }
> 
> public class Banana {
>   private String id;
>   public String getId() { return id; }
>   public void setId(String id) { this.id = id; }
> }
> 
> This approach implies using the nested taglibs package. It has
> potential downside that many objects get created.
> 
> Another approach is to create a 'super' object to aggregate the
> data for the join between tables. e.g.
> 
> public class MonkeyBanana {
>   private String name; //Monkey name
>   private String id; //Banana id;
> }
> 
> This is essentially a denormalization of the Monkey and Banana
> objects. It is more redundant, but we don't need to use the
> nested taglib package and we create fewer objects.
> 
> Does anyone have advice regarding which approach is better?
> 
> Vlad
> 
> 
> 
> 
> 
> 
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 


=====
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Search the archive:-
http://www.mail-archive.com/struts-user%40jakarta.apache.org/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Keith Bacon - Looking for struts work - South-East UK.
phone UK 07960 011275

__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

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

Reply via email to