Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to set SqlMapClientTemplate from spring xml
    text
    copied!<p>I've got following java class. </p> <pre><code>package com.org.data.dbresource; import org.springframework.orm.ibatis.SqlMapClientTemplate; public class DBConnectionManager { private SqlMapClientTemplate sqlMapClientTemplate; public void setSqlMapClientTemplate (SqlMapClientTemplate sq) { this.sqlMapClientTemplate = sq; } public SqlMapClientTemplate getSqlMapClientTemplate () { return this.sqlMapClientTemplate; } } </code></pre> <p>My Spring xml looks like following:</p> <pre><code> &lt;bean id="IbatisDataSource" class="org.springframework.jndi.JndiObjectFactoryBean"&gt; &lt;property name="jndiName" value="jdbc/RSRC/app/oltp"/&gt; &lt;/bean&gt; &lt;bean id="MySqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"&gt; &lt;property name="configLocation" value="classpath:sql-map.xml"/&gt; &lt;property name="dataSource" ref="IbatisDataSource"/&gt; &lt;/bean&gt; &lt;bean id="myObject" class="com.org.data.dbresource.DBConnectionManager"&gt; &lt;property name="sqlMapClientTemplate" ref="MySqlMapClient"/&gt; &lt;/bean&gt; </code></pre> <p>Error I get is:</p> <blockquote> <p>Failed to convert property value of type [com.ibatis.sqlmap.engine.impl.SqlMapClientImpl] to required type [org.springframework.orm.ibatis.SqlMapClientTemplate] for property 'sqlMapClientTemplate';</p> </blockquote> <p>Everything works fine if, instead of <code>SqlMapClientTemplate</code> I pass <code>SqlMapClient</code> but then I have to explicitly catch <code>SQLExceptions</code></p> <p>What should I change?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload