On 6/23/07, Robert . <[EMAIL PROTECTED]> wrote:



On 6/23/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
>
> On 6/23/07, Robert . <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > On 6/23/07, Flemming Boller < [EMAIL PROTECTED]> wrote:
> > >
> > > On 6/23/07, Robert . < [EMAIL PROTECTED] > wrote:
> > >
> > > There is no silverbullet here. Each solution has its drawbacks.
> > > However the solution I have come to best like is only using the 
@SpringBean
> > > in pages, and then pass on the springbean as argument to where every it is
> > > needed. That way it is also more clearly seen in the page where the 
service
> > > is used.
> > >
> >
> > I'm curious when this is simpler that accessing the DAOs from the
> > application object. I find it annoying so far that I find out that I need a
> > certain DAO in my DetachableXXXModel, and then, for example, have to pass it
> > from the page to the XXXDataProvider, save a reference there, and in the
> > model method pass it to the DetachableXXXModel.
> >
>
> there is nothing wrong with doing this
>
> class PersonModel extends LoadableDetachableModel {
>    @SpringBean
>    private PersonDao dao;
>    private final long id;
>    public PersonModel(long id) {
>      this.id=id;
>      InjectorHolder.getInjector().inject(this);
>    }
>    ...
> }
>

Ah very interesting to see this is possible. Still I am thinking why this
would be better than using the application to hold the DAOs.


this is better because if you use applications to hold non-proxied daos you
have to be very careful not to leave a reference to it anywhere. because
dependencies injected throgh @SpringBean are special proxies you dont have
to worry about it because the proxies can be safely serialized.

-igor
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to