Saving child collections with OrmLite on Android with objects created from Jackson Saving child collections with OrmLite on Android with objects created from Jackson android android

Saving child collections with OrmLite on Android with objects created from Jackson


You might want to try using a ForeignCollection instead of a Collection in your parent class.

From the ORMLite-Documentation:

"The foreign collections support the add() and remove() methods in which case the objects will be both added or removed from the internal list if the collection is eager, and DAO calls will be made to affect the [child] table as well for both eager and lazy collections."

(http://ormlite.com/javadoc/ormlite-core/doc-files/ormlite_2.html#Foreign-Collection)

On the documentation of the class itself it also states that the add / remove is forwarded to the database. (http://ormlite.com/javadoc/ormlite-core/com/j256/ormlite/dao/ForeignCollection.html#add(T))

I've never worked with this, though, so I just hope the documentation is correct and this helps you solving your problem. :-)