AnyProgress on multiple datasources?

2 views
Skip to first unread message

nino martinez wael

unread,
Jun 5, 2010, 6:32:50 PM6/5/10
to ibaguice
Hi as Eelco had I to have a situation where I depend on to different
databases, It's find if it requires to different configurations,
actually it's best that way..

Is it supported yet?

regards Nino

Simone Tripodi

unread,
Jun 6, 2010, 9:15:15 AM6/6/10
to ibag...@googlegroups.com
Hola Nino,
nice to meet you also in this place :)
Current iBaGuice development version still doesn't support the
multiple datasources since we're focused on deploying the library on
the Mvn central repo...

BTW you can simply realize it reusing the
com.googlecode.ibaguice.core.XMLSqlSessionFactoryProvider with a few
tricks:

first of all, implement the binding annotations like @DataSource1,
@DataSource2, then in you modules just bind:

@Override
protected void configure() {
this.bind(SqlSessionFactory.class).annotatedWith(DataSource1.class).toProvider(new
SqlSessionFactoryProviderType("/com/acme/sqlsession1.xml")).in(Scopes.SINGLETON);
this.bind(SqlSessionFactory.class).annotatedWith(DataSource2.class).toProvider(new
SqlSessionFactoryProviderType("/com/acme/sqlsession2.xml")).in(Scopes.SINGLETON);
}

Hope this helps as first idea... if you have better ideas and would
like to contribute, you're more than welcome!!!
Saludos, hasta pronto!
Simo

http://people.apache.org/~simonetripodi/

nino martinez wael

unread,
Jun 6, 2010, 1:13:09 PM6/6/10
to ibag...@googlegroups.com
It does'nt look so bad. Only thing are that I need to look in a third
database to find out which servers datasource 1 and 2 are on.. But
thats the nice thing with opensource, you can always look in the
source :)

And how far are you from deploying in maven central?

regards Nino

2010/6/6 Simone Tripodi <simone....@gmail.com>:

Simone Tripodi

unread,
Jun 6, 2010, 4:26:47 PM6/6/10
to ibag...@googlegroups.com
Hola Nino,
We already opened the issue on Sonatype JIRA, we should be able to
deploy iBaGuice in 2-3 working days so we can finally release the 1.0
:)
Let's keep in touch, saludos!!!
Simo

http://people.apache.org/~simonetripodi/

On Sun, Jun 6, 2010 at 7:13 PM, nino martinez wael

Reply all
Reply to author
Forward
0 new messages