[Aerogear-users] Many-To-Many Data Store relationship SQLStore

Summers Pittman supittma at redhat.com
Fri Sep 12 10:52:21 EDT 2014


On 9/11/2014 2:20 PM, Ramon Pires da Silva wrote:
> the Data Store with SQLStore for android sample at github are really 
> simple, i need some example how to work with many-to-many 
> relationship,or some tip about it.
SQLStore really doesn't support many-to-many style relationships*. If 
you need a full ORM with proxies, lazy loading, etc then that is a 
different problem.  If you can get by with Key:Value mappings and some 
simple querying then we might be able to help.

For each pair of relationships you can create a mapping object and use 
three SQLStores.  Two stores would be for your objects and the third 
would be a for the object which manages the mapping (essentially a 
RecordId and a pair of Ids for the other two objects).  Then I would 
wrap these three stores in a ContentProvider which will manage 
assembling and disassembling your objects when the app queries them.

*SQLStore works by serializing your object to JSON and then storing each 
property in a table.  The table schema is (from my memory) is the fully 
qualified property name, the property value, a row id, and the id of the 
parent row.  It is really good for storing objects which are basically 
unidirectional graphs with a unique key.  It is very slow at doing any 
other querying, and it can't handle complex graphs (Many to many, 
cycles, etc).  It can handle nested collections however.

>
>
> _______________________________________________
> Aerogear-users mailing list
> Aerogear-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-users/attachments/20140912/f07ac6a5/attachment-0001.html 


More information about the Aerogear-users mailing list