Query returning Zero for paticular value in java
<p>Hi all<br>
  Am using a loop to execute a query but am getting zero for a particular column.</p>

<p>Example<br></p>

<pre><code>for(i=0;i&lt;10;i++){
    Query query = entityManager.createNativeQuery("select id, (1+1) as regular from tab1 where id='"+i+"'");
    List result = query.getResultList();
    System.out.println(result.get(0).getRegular);
}
</code></pre>

<p>My Output is</p>

<pre><code>2
0
2
0
0
0
2
0
2
0
</code></pre>
