Current iBatis have severe encoding issue. But this will fix in next release.(I heard iBatis 2.3 will release later this week.)
http://issues.apache.org/jira/browse/IBATIS-349
However to apply this fix, SqlMapClientFactoryBean modification is necessary.
Modification is just trivial.
Current spring 2.0 and 2.0.1 has following code on SqlMapClientFactoryBean
try {
// Build the SqlMapClient.
InputStream is = this.configLocation.getInputStream();
this.sqlMapClient = (this.sqlMapClientProperties != null) ?
SqlMapClientBuilder.buildSqlMapClient(new InputStreamReader(is), this.sqlMapClientProperties) :
SqlMapClientBuilder.buildSqlMapClient(new InputStreamReader(is));
// Tell the SqlMapClient to use the given DataSource, if any.
if (this.dataSource != null) {
TransactionConfig transactionConfig = (TransactionConfig) this.transactionConfigClass.newInstance();
DataSource dataSourceToUse = this.dataSource;
if (this.useTransactionAwareDataSource && !(this.dataSource instanceof TransactionAwareDataSourceProxy)) {
dataSourceToUse = new TransactionAwareDataSourceProxy(this.dataSource);
}
transactionConfig.setDataSource(dataSourceToUse);
transactionConfig.initialize(this.transactionConfigProperties);
applyTransactionConfig(this.sqlMapClient, transactionConfig);
}
}
Following two line need to modify.
SqlMapClientBuilder.buildSqlMapClient(new InputStreamReader(is), this.sqlMapClientProperties) :
SqlMapClientBuilder.buildSqlMapClient(new InputStreamReader(is));
Modification is just trivial. I think just remove new InputStreamReader(is) is enough.
SqlMapClientBuilder.buildSqlMapClient(is, this.sqlMapClientProperties) :
SqlMapClientBuilder.buildSqlMapClient(is);
This worked fine on my environment. Of cause iBatis library update is necessary. (Currently we can't download iBatis 2.3, so I checked out latest source and build myself.)
Thanks for pointing this out! I've added a corresponding reflection check, which uses the InputStream-based API if available, else falls back to the traditional Reader-based API. This allows us to leverage this new iBATIS 2.3 feature while remaining compatible with iBATIS 2.1/2.2.
This should already be available in the next nightly 2.0.2 snapshot (http://www.springframework.org/snapshots
). Feel free to give it an early try...
Juergen