John Menke wrote:

>I am planning to use the Nesting Extension...
>
sweet  :)

>The MonkeyStruts example uses one ActionForm bean on the outermost level
>that links to other beans recursively in a parent child heirarchy.  It looks
>like each child bean in the hierarchy is instantiated from methods called by
>it's parents class.
>
MonkeyStruts example was made only to be just that, an example. To make 
it easier to see where things are built, and move on to more important 
considerations.

>I suggest the following for persistance...
>
[ ... ]

>Is there a better way of doing this or am I on the right track?
>

No, you're pretty much on the ball really. The only thing that people 
pushing "best practices" will say is to make sure that you externalize 
the persistence management from the bean model itself. That said, it can 
also make life really easy if you drive it directly from within the bean 
model itself (Who said that!? :)

In practice, it will really depend on the nature of your data structure. 
If it's list style, you'd be mad not to simply drive it from a system 
that will query the DB loop through populating objects putting them in a 
list. But if it's a complex structure of different nested types (and 
lets face it, the nested tags make this possible now more than ever), 
you could drive it exactly as you've described having the beans manage 
their dirty state and have a one-to-one level mapping from the 
persistence mechanism to nested bean (ie: have each nested bean know how 
it's to be stored). There are various ways to take this back to the MVC 
paradigm keeping the model totally separate, using patterns etc.

Only to say that there's not one recommended system, as it will vary 
from requirement to requirement. Some persistence mechanisms, like XML 
marshaling, will get you from persistent storage to nested java objects, 
back to storage almost for free (although such systems don't have the 
brute force performance of a DB query). Where as a table structure page 
will be almost the typical top-down list approach. To the ultra simple, 
I've made a tiny web app that serializes the entire model to disk. The 
data in it was shared to all users, so there wasn't any 
concurrency/performance issues.

The nested tags can just be a simpler alternative to the usual Struts 
tags, taking the exact same consideration as a typical Struts app. 
Horses for courses I'm afraid.

How complex are the types/structure of your hierarchy?...


Arron.



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

Reply via email to