ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Lamey <cla...@localmatters.com>
Subject Re: Parsing xml-Definition For Creating SqlMapClient
Date Wed, 28 Nov 2007 19:59:46 GMT
The sqlmapclient is thread-safe, you can have multiple threads hit a single
sqlmapclient instance with no problems.

Read page 58 of the iBATIS PDF doc for details on threading and
transactions.

On 11/28/07 9:53 AM, "Ralf Assmann" <ralf.assmann@innovations.de> wrote:

> 
> Hi there,
> 
> creating a SqlMapClient for iBATIS, we use a code like this,
> xmlDefinition refers to the sqlMapConfig.xml-file. The connection has to
> be set from extern, depending on the kind of application.
> 
>     Reader reader = Resources.getResourceAsReader(xmlDefinition);
>     SqlMapClient sqlMapClient =
> SqlMapClientBuilder.buildSqlMapClient(reader);
>     sqlMapClient.setUserConnection(aUserConnection);
> 
> Using this code in a java-server where a lot of different threads with
> different connections work at a time, the xml-file will be parsed every
> call. For this, the application is not that fast, althought the used
> xml-definition never changes during the call.
> 
> Is there a possibility to "cache" the sqlMapClient, but the used
> sqlMapClient in every thread has its own connection? Can the
> sqlMapClient be hold e.g. as an static variable but uses different user
> connections?
> 
> Many thanks.
> 
> 
> Ralf
> 
> 
> 
> 


Mime
View raw message