NamedParameterJdbcTemplate setting connection fetch size property
<p>We are using Spring 2.6 and we use jdbcTemplate as well as NamedparameterJdbcTemplate in our system and configurations are as follows.</p>

<pre><code> &lt;bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"&gt;
    &lt;constructor-arg ref="dataSource"&gt;&lt;/constructor-arg&gt;
    &lt;property name="fetchSize" value="500&gt;
  &lt;/bean&gt;

&lt;bean id="namedParameterJdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate"&gt;
    &lt;constructor-arg ref="dataSource"&gt;&lt;/constructor-arg&gt;
  &lt;/bean&gt;
</code></pre>

<p>While jdbcTemplate has a property "fetchSize", namedParameterJdbcTemplate does not have. I want to set the fetchSize for this so i came up with another constructor for namedParameterJdbcTemplate which accepts "jdbcTemplate", so i configured my bean as follows to use fetchSize of 500 which is already configured for jdbcTemplate:</p>

<pre><code>&lt;bean id="namedParameterJdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate"&gt;
    &lt;constructor-arg ref="jdbcTemplate"&gt;&lt;/constructor-arg&gt;
  &lt;/bean&gt;
</code></pre>

<p>But after this i am getting following exceptions for few queries :</p>

<p>com.sybase.jdbc3.jdbc.SybSQLException: Cursor 'jconnect_implicit_16' was declared with a FOR UPDATE clause. This cursor was found to be read only.</p>

<pre><code>    at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:121)
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:322)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:582)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:616)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:641)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:657)
    at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.query(NamedParameterJdbcTemplate.java:123)
    at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.query(NamedParameterJdbcTemplate.java:127)
</code></pre>

<p>Can someone please suggest its solution?</p>
