[aerogear-dev] SQLite Store Order By and Auto Increment ID

Daniel Passos daniel at passos.me
Fri Mar 21 12:19:30 EDT 2014


Hi Thiago,

Sorry for my delay.

AeroGear does not control the id value. This is delegated to IdGenerator,
so it's your (developer) responsibility to control it.

My sugestion is, store the last id used in a SharedPreferece or use UUID
(the AeroGear DefaultIdGenator[1]).

I have added an example using SharedPreference in AeroGear Android
Cookbook[2]

[1]
https://github.com/aerogear/aerogear-android/blob/master/src/org/jboss/aerogear/android/impl/datamanager/DefaultIdGenerator.java
[2] https://github.com/aerogear/aerogear-android-cookbook/pull/12

-- Passos



On Mon, Mar 17, 2014 at 6:45 PM, Tiago Resende <tiagor87 at gmail.com> wrote:

> The AeroGear isn'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.
>
>
> 2014-03-17 18:11 GMT-03:00 Daniel Passos <daniel at passos.me>:
>
>>  Hi Thiago,
>>
>> Nice questions. Answers inline.
>>
>> On Sun, Mar 16, 2014 at 6:20 PM, Tiago Resende <tiagor87 at gmail.com>wrote:
>>
>>> Hi guys, thanks for the other day, you really helped me.
>>>
>>> I have two questions today.
>>>
>>> How can I perform a query using "order by" statement in SQLStore?
>>>
>>> I did a readAll, then I ordered in memory using Ordering<T>.
>>>
>>
>> Unfortunately. We don't have this option for now.
>>
>>
>>> 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's not working beautifully for SQLStore. I had to create an
>>> update method and call it for every object, I didn't like it, but I
>>> couldn't find a better solution reading the documentation.
>>>
>>
>> No, who creates the id is always idGenerator. What's the problem?
>>
>>
>>> I really appreciate your help.
>>>
>>> Thanks.
>>>
>>> --
>>> *Tiago de Carvalho Resende*
>>>
>>
>> _______________________________________________
>> aerogear-dev mailing list
>> aerogear-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>
>
>
>
> --
> *Tiago de Carvalho Resende*
> Desenvolvedor
>
> "O importante não é saber fazer,
>
> é saber de onde copiar."
>
>  por Bernardo Esbérard
>
>
>
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-dev/attachments/20140321/c54db924/attachment.html 


More information about the aerogear-dev mailing list