Reference: http://appfuse.org/display/APF/AppFuse+Maven+Plugin
> Stop and think before generating code!
> At first, I didn't want to add a code-generation feature like this
> because you end up with a 1-to-1 relationship between tables/pojos,
> DAOs and Managers. On most of my projects, I have far fewer DAOs and
> Managers than POJOs.
> </code>
>
> ;-)
>
> Matt
>
Thanks Matt,
hadn't seen those before. The problem still remains: I still cannot use the
beans (be it a Manager or as in my case a DAO) that has been instantiated in
the Controllers (strange as it sometimes works). Is there something
particular to be considered on how the beans defined in the
ApplicationContext files are handled or their accessibility?
Now, to not just let the granularity question hanging loose, this is what I
interpreted into the different groups of classes:
- Model: a simple bean that will be persisted to the database
- DAO: a class whose only purpose is to grant access to objects from the
Model
which includes looking up by some parameter, saving, updating and removing
them
from the persistent storage. Usually these are only for a single class
from the Model
or closely related ones (Person <-> Address for example)
- Manager: where the action happens, these get called from the frontend to
execute
any functionality on the objects. Managers use DAOs to retrieve data from
the
persistent storage, modify it and save it back.
- Controllers: these just read the incoming requests, interpret them, and
then pass
them on to the managers.
So in my case, just to have a concrete example: The Model would be Picture
(with all of its details), then I'd have a PictureDao which allows lookup,
retrieval and storage of Pictures and then I'd have the PictureManager which
does all sorts of fancy stuff, like resizing the Pictures, creating
thumbnails, create new pictures, add watermarks or simply look up for the
controllers (this is where I'd prefer to simply have the Daos because
otherwise all this gets duplicated).
The Controllers gather all the request information (Picture metadata,
Picture contents, ...) and then pass it to the Manager, who will process it
and return some result which is then displayed back to the user.
Is this correct so far, or have I misunderstood something?
Regards,
Christian
-----
Christian Decker
http://blog.snyke.net
--
View this message in context:
http://www.nabble.com/Accessing-DAOs-in-the-controllers-tp20217953s2369p20236277.html
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]