No, I can't. I found a way to do that, but I don't know if it's the
best. I have a method that returns a SqlMapClient to the dao in a
singleton class. It's a class that extends SqlMapClientFactoryBean from
SpringFramework.

Before returning it to the dao, I modify it in the following way:

SqlMapExecutorDelegate delegate = sqlClient.getDelegate();
if (delegate.getTxManager() == null) {
        delegate.setTxManager(createTxManager());
}

and:

private TransactionManager createTxManager() {
        JdbcTransactionConfig config = new JdbcTransactionConfig();
        config.setDataSource(dataSource);
        config.setMaximumConcurrentTransactions(concurrentTransactions);
        TransactionManager txManager = new TransactionManager(config);
        return txManager;
}

dataSource and concurrentTransactions are privated attributes of my
class, setted when it's created. Now I've configured a dataSource
without defining it in the xml file.

It's the best way to do that?

Thanks.

Em Qui, 2005-03-03 �s 08:11 -0600, Brice Ruth escreveu:
> Can you use JNDI? This way, you can store your created datasource in
> JNDI and if you configure iBATIS to use that JNDI resource, then your
> problem is solved - iBATIS will not create a new instance, it will
> assume that the JNDI DataSource is ready to be used.
> 
> BR
> 
> 
> On Thu, 03 Mar 2005 09:05:52 +0000, Eduardo Piva <[EMAIL PROTECTED]> wrote:
> > Hi Scott, I need something like that either. I have a instance of a
> > datasource already created and I want to make iBatis use this instance.
> > It's a DBCP instance. Is there anyway I can set it, without using XML
> > (since iBatis will instantiate a new one)?
> > 
> > Thanks,
> > 
> > Eduardo.
> > 
> > Em Ter, 2005-03-01 �s 17:38 -0500, Scott Zhu escreveu:
> > > I guess the problem I'm trying to solve is that I don't have a
> > > pre-defined property file I can include in the sqlMapConfig.xml as the
> > > resource. But some of my properties in there need to be parameterized.
> > > For example, the DataSource value, I will fetch it from a
> > > configuration server at runtime. So my question is, is there a way
> > > that I can feed this information into the sqlMapConfig map as I build
> > > my sqlMapClient instance? Thanks for your help.
> > >
> > 
> >
> 

Reply via email to