<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=jhermann" rel="nofollow">Jürgen Hermann</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-4370?redirect=false" rel="nofollow">SPR-4370</a></strong> and commented</p>
<p dir="auto">The API docs do not mention in what order (priority) duplicated properties are resolved. When using setLocations(a, b), is a:foo preferred over b:foo or vice versa?</p>
<p dir="auto"><a href="http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/core/io/support/PropertiesLoaderSupport.html#setLocations(org.springframework.core.io.Resource%5B%5D)" rel="nofollow">http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/core/io/support/PropertiesLoaderSupport.html#setLocations(org.springframework.core.io.Resource[])</a></p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.0.8, 2.5 final</p>
<p dir="auto"><strong>Backported to:</strong> <a href="https://github.com/spring-projects/spring-framework/milestone/46?closed=1">2.0.9</a></p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=andre.rouel" rel="nofollow">André Rouél</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-8652?redirect=false" rel="nofollow">SPR-8652</a></strong> and commented</p>
<p dir="auto">In a table column we use 19-digit IDs. The column type is set to NUMBER. An example of an ID is "1000000009704976470". Now, if we access by using <code class="notranslate">NamedParameterJdbcTemplate.queryForLong (String sql, SqlParameterSource paramSource)</code> or overloaded methods, it returns the for example the long <code class="notranslate">1000000009704976512L</code> instead of <code class="notranslate">1000000009704976470L</code>. The cause lies in the implementation of the method <code class="notranslate">queryForLong</code>.</p>
<p dir="auto">The current implementation looks like this:<br>
<code class="notranslate">public long queryForLong(String sql, SqlParameterSource paramSource) throws DataAccessException {</code><br>
<code class="notranslate">Number number = queryForObject(sql, paramSource, *Number.class*);</code><br>
<code class="notranslate">return (number != null ? number.longValue() : 0);</code><br>
<code class="notranslate">}</code></p>
<p dir="auto">A solution could look like this:<br>
<code class="notranslate">public long queryForLong(String sql, SqlParameterSource paramSource) throws DataAccessException {</code><br>
<code class="notranslate">Number number = queryForObject(sql, paramSource, *Long.class*);</code><br>
<code class="notranslate">return (number != null ? number.longValue() : 0);</code><br>
<code class="notranslate">}</code></p>
<p dir="auto">One note, the <code class="notranslate">JdbcTemplate</code> class implements the method <code class="notranslate">queryForLong</code> properly.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.5.6, 3.0.5</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/browse/DATAJDBC-15" rel="nofollow">DATAJDBC-15</a> Incorrect output of big numbers when using NamedParameterJdbcTemplate.queryForLong (<em><strong>"is duplicated by"</strong></em>)</li>
</ul>
<p dir="auto"><strong>Referenced from:</strong> commits <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/77372d7cdb9cbb70ebc99ca86fc9eb949b4dba93/hovercard" href="https://github.com/spring-projects/spring-framework/commit/77372d7cdb9cbb70ebc99ca86fc9eb949b4dba93"><tt>77372d7</tt></a>, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/9b0412f35fd9cc3a14b1a737af98f5c3119cea41/hovercard" href="https://github.com/spring-projects/spring-framework/commit/9b0412f35fd9cc3a14b1a737af98f5c3119cea41"><tt>9b0412f</tt></a>, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/118ee3fce89f305ea2fc938d539435218fa4e9cc/hovercard" href="https://github.com/spring-projects/spring-framework/commit/118ee3fce89f305ea2fc938d539435218fa4e9cc"><tt>118ee3f</tt></a></p>