How to use Sattinsky ORM with @Table annotation

I was very lucky with SugarOrm for Android, but I ran into a problem. I use it with GSON to serialize Json and I want to get rid of the id attribute SugarRecord. I know that I have to use @Tablethe annotation, and then exclude a specific area of serialization using @Expose, but after annotating the class with @Table I can not use .save(), delete()... methods on the object, as it is the case expands SugarRecord. I do not know how to save objects using annotation @Table.

I found the documentation here very limited.

+4
source share
1 answer

The document has not yet been updated for saving based on annotation. The save (), delete () methods will be available as static methods in the SugarRecord class.

So instead:

object.save()

You would do this:

SugarRecord.save(object)

Check out some of the tests here for a better understanding. https://github.com/satyan/sugar/tree/master/example/src/test/java/com/example/sugartest

+11
source

All Articles