yahoo / squidb

SquiDB is a SQLite database library for Android and iOS
https://github.com/yahoo/squidb/wiki
Apache License 2.0
1.31k stars 132 forks source link

Object Hierarchy #102

Closed inawlaljar closed 8 years ago

inawlaljar commented 8 years ago

Hi,

I have an object hierarchy.. for e.g.

User has many Addresses Class User{ ArrayList

address; }

Will the save in User... "db.persist(user)" will save all addresses? if not, what is the best approach? Thanks, Raj

sbosley commented 8 years ago

If Address is also a table model, the answer is no. SquiDB isn't an ORM and does not manage object relationships, which is by design. You can see this wiki page or this issue for more information.

How you want to manage relations is entirely up to you! There's no single best strategy, although that wiki page and the discussion in the issue offer various options.

If Address is not another table but rather e.g. a serializable POJO, you may be able to use the jackson plugin to store the list as a serialized String -- let us know if this is your use case and we can provide more info.

sbosley commented 8 years ago

I'm assuming this question has been answered since there hasn't been additional activity -- feel free to reply if there are more questions though!