<div dir="ltr">I had to change the code I sent above, It only works without AG, I&#39;ve tested in another project. =&#39;(<div><br></div><div>The AG table structure is much different that I thought. We have just one table mapping all database, right?</div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-17 19:44 GMT-03:00 Tiago Resende <span dir="ltr">&lt;<a href="mailto:tiagor87@gmail.com" target="_blank">tiagor87@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr"><div>It&#39;s not as much beautiful as I liked, but it works.</div><div><br></div><div>Is there anyway to use AG implementation to read the cursor with all fields and retrieve the object? I&#39;ve used &quot;read&quot; to do the magic, but I didn&#39;t like it.</div>


<div><br></div><div>public Collection&lt;T&gt; readSorted(EnumSort enumSort) {</div><div>        String tableName = getTableName();</div><div>        String fieldName = getIdFieldName();</div><div><br></div><div>        String sql = &quot;SELECT %s FROM %s ORDER BY %s %s&quot;;</div>


<div>        if (enumSort == EnumSort.ASCENDING) {</div><div>            sql = String.format(sql, fieldName, tableName, fieldName, &quot;ASC&quot;);</div><div>        } else {</div><div>            sql = String.format(sql, fieldName, tableName, fieldName, &quot;DESC&quot;);</div>


<div>        }</div><div><br></div><div>        Collection&lt;T&gt; collection = new ArrayList&lt;T&gt;();</div><div><br></div><div>        SQLiteDatabase database = this.getReadableDatabase();</div><div>        Cursor cursor = database.rawQuery(sql, new String[]{});</div>


<div>        for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {</div><div>            collection.add(this.read(cursor.getInt(0)));</div><div>        }</div><div><br></div><div>        return collection;</div>


<div>    }</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-17 18:54 GMT-03:00 Tiago Resende <span dir="ltr">&lt;<a href="mailto:tiagor87@gmail.com" target="_blank">tiagor87@gmail.com</a>&gt;</span>:<div>

<div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The &quot;order by&quot; problem I solved implementing an extension for AG Store.<div><br></div><div><br>


<div><br></div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-17 18:45 GMT-03:00 Tiago Resende <span dir="ltr">&lt;<a href="mailto:tiagor87@gmail.com" target="_blank">tiagor87@gmail.com</a>&gt;</span>:<div>


<div><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The AeroGear isn&#39;t reading the last Id saved in database, so, it starts over and over again, overwriting my old data every time a open my application.</div>



<div class="gmail_extra"><br><br><div class="gmail_quote">
2014-03-17 18:11 GMT-03:00 Daniel Passos <span dir="ltr">&lt;<a href="mailto:daniel@passos.me" target="_blank">daniel@passos.me</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div><div>
<div dir="ltr">Hi Thiago,<div><br></div><div>Nice questions. Answers inline.</div><div class="gmail_extra"><br><div class="gmail_quote"><div>On Sun, Mar 16, 2014 at 6:20 PM, Tiago Resende <span dir="ltr">&lt;<a href="mailto:tiagor87@gmail.com" target="_blank">tiagor87@gmail.com</a>&gt;</span> wrote:<br>






<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi guys, thanks for the other day, you really helped me. <div>






<br></div><div>I have two questions today.<div><br></div><div>How can I perform a query using &quot;order by&quot; statement in SQLStore?</div><div>

<br></div><div>I did a readAll, then I ordered in memory using Ordering&lt;T&gt;.</div></div></div></blockquote><div><br></div></div><div>Unfortunately. We don&#39;t have this option for now.</div><div><div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div dir="ltr"><div><div>The second question is how can I indicate to AeroGear that it should use an auto increment primary key for a table. I created an AutoGeneratorId Class, but it&#39;s not working beautifully for SQLStore. I had to create an update method and call it for every object, I didn&#39;t like it, but I couldn&#39;t find a better solution reading the documentation.</div>






</div></div></blockquote><div><br></div></div><div>No, who creates the id is always idGenerator. What&#39;s the problem?</div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">






<div dir="ltr"><div><div>I really appreciate your help.</div><div><br></div><div>Thanks.</div><span><font color="#888888"><div><div><br></div>-- <br><div dir="ltr"><b><font color="#444444">Tiago de Carvalho Resende</font></b></div>






</div></font></span></div></div></blockquote></div></div></div></div>
<br></div></div>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><span><font color="#888888"><br></font></span></blockquote></div><span><font color="#888888"><br>



<br clear="all"><div><br></div>-- <br><div dir="ltr"><b><font color="#444444">Tiago de Carvalho Resende</font></b><br>
<div><font color="#666666">Desenvolvedor</font></div><div><font color="#999999"><br></font></div><div><font color="#666666">&quot;O importante não é saber fazer, </font></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">




<blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font color="#666666">é saber de onde copiar.&quot; </font></div></blockquote></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px">



<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font size="1" style="color:rgb(153,153,153)">por Bernardo Esbérard</font></div></blockquote></blockquote></blockquote><div> </div></div>
</font></span></div>
</blockquote></div></div></div><div><div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><b><font color="#444444">Tiago de Carvalho Resende</font></b><br><div><font color="#666666">Desenvolvedor</font></div>
<div><font color="#999999"><br>
</font></div><div><font color="#666666">&quot;O importante não é saber fazer, </font></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>


<font color="#666666">é saber de onde copiar.&quot; </font></div>
</blockquote></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font size="1" style="color:rgb(153,153,153)">por Bernardo Esbérard</font></div>



</blockquote></blockquote></blockquote><div> </div></div>
</div></div></div>
</blockquote></div></div></div><div><div class="h5"><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><b><font color="#444444">Tiago de Carvalho Resende</font></b><br><div><font color="#666666">Desenvolvedor</font></div>

<div><font color="#999999"><br>
</font></div><div><font color="#666666">&quot;O importante não é saber fazer, </font></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>

<font color="#666666">é saber de onde copiar.&quot; </font></div>
</blockquote></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font size="1" style="color:rgb(153,153,153)">por Bernardo Esbérard</font></div>


</blockquote></blockquote></blockquote><div> </div></div>
</div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><b><font color="#444444">Tiago de Carvalho Resende</font></b><br><div><font color="#666666">Desenvolvedor</font></div><div><font color="#999999"><br>

</font></div><div><font color="#666666">&quot;O importante não é saber fazer, </font></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>
<font color="#666666">é saber de onde copiar.&quot; </font></div>
</blockquote></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font size="1" style="color:rgb(153,153,153)">por Bernardo Esbérard</font></div>

</blockquote></blockquote></blockquote><div> </div></div>
</div>