ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Voorhoeve, Niels {PBG}" <niels.voorho...@pepsi.com>
Subject RE: Same table, multiple sources
Date Tue, 08 Nov 2005 15:16:13 GMT

Must have missed it in the docs.


-----Original Message-----
From: larry.meadors@gmail.com [mailto:larry.meadors@gmail.com] On Behalf Of
Larry Meadors
Sent: Friday, November 04, 2005 4:03 PM
To: user-java@ibatis.apache.org
Subject: Re: Same table, multiple sources

Uhm, that is already available. ;-)

public Dao getDao(Class iface, String contextId);

<context id="foo">...</context>
<context id="bar">...</context>


On 11/4/05, Voorhoeve, Niels {PBG} <niels.voorhoeve@pepsi.com> wrote:
> Hi,
> I have a situation where I need to read the same table from a couple of
> different servers.  I'm using the ibatis dao framework on top of ibatis
> sqlmaps.  I've thought of a couple of solutions and was wondering what the
> best practice is?
> 1.
>         a. Copy the sqlmap config file for the table to a new name.
>         b. Create another Dao class and context to use the new file.
> 2.
>         a. Create a second instance of a DaoManager from a second
> dao-config.xml which reuses the same dao class and table.
> It would be nice if the daoManager had a feature to specify the context to
> use so that the above wouldn't be necessary.  Would it be feasible to add
> such a feature?
> I guess it would look something like:
>         dao-config.xml:
>                 <context name="this.server">
>                 ...
>                 <context name="that.server">
>         daoManager.getDao(SomeBean.class, "this.server");
> Thanks,
> Niels

View raw message