You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adam Hardy <ah...@cyberspaceroad.com> on 2004/04/08 13:24:56 UTC

monkeys-bunches-bananas design issue - not Friday

I've got a design issue re nested beans and DTOs from EJB, the classical 
(if that's not stretching it) monkeys-bunches-bananas situation.

I was wondering how people solve the issue of putting the nested beans 
together from the data in the database.

I am creating my DTOs from a CMP-EJB layer using xdoclet-generated 
classes, which is ideal up to this point.

I want to nest my bananas in my bunches in my monkey, basically, but all 
these classes are xdoclet-generated, so I can't modify them to contain 
an arraylist of child objects.

I'm thinking of subclassing them so the subclass can hold the arraylist 
of child beans.

That seems ugly to me though when constructing the data set, because I 
can get arraylists of the seperate classes but I then have to loop 
through them putting the child beans in the parents.

Anybody got a better way?

Thanks
Adam

-- 
struts 1.2 + tomcat 5.0.19 + java 1.4.2
Linux 2.4.20 Debian


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: monkeys-bunches-bananas design issue - not Friday

Posted by Paul Thomas <pa...@tmsl.demon.co.uk>.
On 08/04/2004 12:24 Adam Hardy wrote:
> I've got a design issue re nested beans and DTOs from EJB, the classical 
> (if that's not stretching it) monkeys-bunches-bananas situation.
> 
> I was wondering how people solve the issue of putting the nested beans 
> together from the data in the database.
> 
> I am creating my DTOs from a CMP-EJB layer using xdoclet-generated 
> classes, which is ideal up to this point.
> 
> I want to nest my bananas in my bunches in my monkey, basically, but all 
> these classes are xdoclet-generated, so I can't modify them to contain 
> an arraylist of child objects.
> 
> I'm thinking of subclassing them so the subclass can hold the arraylist 
> of child beans.
> 
> That seems ugly to me though when constructing the data set, because I 
> can get arraylists of the seperate classes but I then have to loop 
> through them putting the child beans in the parents.
> 
> Anybody got a better way?


Probably not better but I've has to overcome the same problem and found 
that something like

public class Monkey {
    MonkeyDTO ...
    Bunch[] ...
}

public class Bunch {
    BunchDTO ....
    BananaDTO[] ....
}

with appropriate getters/setters works for me.


-- 
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for 
Business             |
| Computer Consultants         | 
http://www.thomas-micro-systems-ltd.co.uk   |
+------------------------------+---------------------------------------------+

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org