It took me about 4 hours to follow an example in a book about android, where they showed the code for just a table. I had 6 tables, so I extended the class for every table I had. Dirty but effective. The problem appeared when I was deciding how to access to related objects. For instance, I have a Piece object, which has a list of pieces (using a table which connects a piece to another piece). Well, suppose each Piece can have up to 15 (on average) of those pieces, and I need to access them as an object (not as an index).
This sort of connection was not commented in the book, and I came up with a good (yet really slow) way of getting these, by querying for the related pieces indexes, and then getting them just as a regular Piece (with a getPiece(long id)
method). The big problem is that it takes about 5 seconds to load 10 Pieces with their related pieces.
I was wondering if there is an already defined Data Acces Layer styling for complex objects in Android. (I got used to the way Yii framework for PHP does)
Do you know any good implementation for getting related objects fairly fast? Thanks in advance
Well, it's been a long time, but I'll write what I'm using right now. It's ORMLite: It's not what I expected to be, relations are still a little pain, but hey, at least it encapsulates all the procedures.