This is probably a conversation more appropriate for the user list,
but I think this is poor design - linking DAO classes is going to make
them more difficult to reuse, and IMO, should be done at a higher
level - like in a service layer that aggregates DAO calls (and can
provide more controlled transactional support, too).

If you feel that you can make the change to support this without
breaking compatibility and write the appropriate unit tests, feel free
to do so and post it with a request in JIRA.

Larry


On 2/9/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I will have access to other DAO instances within a DAO instance to have 
> access to other data infos. Therefore I need the context id of current DAO 
> instance.
>
> For example:
>
> I have a UserSqlMapDao and a GroupSqlMapDao.
>
> I support requesting users with group infos. Therefore I will request all 
> groups from the GroupSqlMapDao within the UserSqlMapDao class.
> I support also more than one database so I need the context id.
>
> Best regards
> Manuel
>
>  PRÜFTECHNIK Condition Monitoring
>  Franz-Bayer-Straße 14
>  D-88213 Ravensburg
>  http://www.pruftechnik.com
>  Tel: +49 (0)751 76956-12
>  Fax: +49 (0)751 76956-79
>
>  
> ---------------------------------------------------------------------------------------------------------
>
>
>
>  Larry Meadors <[EMAIL PROTECTED]>
> Sent by: [EMAIL PROTECTED]
>
> 09.02.2006 16:44
>
> Please respond to
>  dev@ibatis.apache.org
>
>
> To dev@ibatis.apache.org
>
> cc
>
>
> Subject Re: support
>
>
>
>
>
>
>
>
> What is it that you are trying to accomplish with this?
>
>  Larry
>
>
>  On 2/9/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>  >
>  > Hello developers
>  >
>  > Can you support getting context (id) informations within a DAO impl
>  > instance?
>  >
>  > There is only a access to the daoManager instance that is set in the
>  > constructor of each DAO implementation in
>  > class "XMLDaoManagerBuilder" in method "private DaoImpl parseDao(Element
>  > element, StandardDaoManager daoManager, DaoContext daoContext)
>  > {...Constructor constructor = daoClass.getConstructor(new
>  > Class[]{DaoManager.class});...}"
>  >
>  > If I have access to the context (id) I can call other DAO impls within a 
> DAO
>  > impl with the same context id.
>  >
>  > I think there are many ways to support that:
>  >
>  > 1. add a second constructor to DAO impls that sets the DaoContext in
>  > addition to the DaoManager (so I can call the method
>  > this.daoManager.getDao(<DAO_name>.class, this.daoContext.getId())
>  > 2. add a method to DaoManager that returns the context id for current DAO
>  > instance (so I can call the method this.daoManager.getDao(<DAO_name>.class,
>  > <requested_context_id>)
>  > 3. add a method to DaoManager that returns a DAO instance within the same
>  > context of current DAO instance (like
>  > this.daoManager.getDao(<DAO_name>.class, this)
>  >
>  > What do you think of this?
>  >
>  > Best regards
>  > Manuel Rädle
>  >  Entwicklung
>  >
>  >  PRÜFTECHNIK Condition Monitoring
>  >  Franz-Bayer-Straße 14
>  >  D-88213 Ravensburg
>  >  http://www.pruftechnik.com
>  >  Tel: +49 (0)751 76956-12
>  >  Fax: +49 (0)751 76956-79
>  >
>  > 
> ---------------------------------------------------------------------------------------------------------
>
>

Reply via email to