If known for nothing else, I may go down for creating the infamous 
Monkey/Banana bean model example :)

I don't think that one object per row is much of an overhead for the 
benefit it brings. You are going to have to marshal your results anyway, 
so you may as well create separate objects. Hell, you could even have 
the beans as a proxy only and go driect through to the result set. But 
that's not very MVC.

The nested tags don't "imply" anything. They simply make easier work of 
some more complex markup. Even with nested beans you can use the old 
tags. The nested tags are also better at adaptation. If your spec 
changes, then it will be easier to update with the nested system. Even 
if I'm not nesting beans, I still use the nested tags. They simply make 
life easier.

You could take me as being bias :) ... so are there any other opinions 
out there?...

Arron.

Vladimir Levin 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]>
>
>



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

Reply via email to