ORMLite for Android - episode 1
Par Jerome le mardi 3 janvier 2012, 00:01 - Informatique - Lien permanent
If you read my blog, you certainly know I am an Android fan.
But I am not fond of its SQL features. Some times ago, I looked for
alternatives and I found ORMLite for Android.
My first use was very simple (yet unpublished).
Recently, I tried it with a parent-child relation. There is a persistent object
in another persistent object.
As I wrote in https://plus.google.com/u/0/117007069948230044999/posts/fGyVgXPPf57
After some browsing, I found that parentDao.refresh(parent) must be done
explicitly, else the child is not loaded.
Well ... ok ... its weird for me, as I'm used to server-side ORMs.
Unfortunately it did not work with only
@DatabaseField(foreign= true) on the child field (yes, I believe in
magic ;) )
so, I annotated it with
@DatabaseField(foreign= true, foreignAutoRefresh = true, foreignAutoCreate
= true) and it worked.
I have not tested the updates behaviour yet or the performance as for the
moment, I just want to load my db.
This lib is a nice tool for your android toolbox.