ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Zhu <scott...@gmail.com>
Subject Re: Does the sqlMapConfig look at system properties?
Date Thu, 03 Mar 2005 15:07:44 GMT
I am using JNDI. But the problem is that the user can create a new
data source at runtime. When they do that, they will also add it into
a configuration system, from which our application will fetch the data
source information. So it needs to set this dynamically when it parses
the sqlMapConfig.xml to build the SqlMapClient instance.


On Thu, 03 Mar 2005 11:27:05 +0000, Eduardo Piva <eduardo@gwe.com.br> wrote:
> 
> 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 <eduardo@gwe.com.br> 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.
> > > >
> > >
> > >
> >
> 
>

Mime
View raw message