Questions tagged [sugarorm]

Sugar ORM (Object Relational Mapping). Insanely easy way to work with Android Databases. It is intended to simplify the interaction with SQLite database's in Android.

How does it help

It is intended to simplify the interaction with SQLite database in Android.

  • It eliminates writing SQL queries to interact with SQLite db.
  • It takes care of creating your database.
  • It manages object relationships too.
  • It provides you with clear and simple APIs for db operations

Why it was made

We felt the need for it while building Android apps that had following characteristics:

  • Fairly large and complex data model.
  • Primary work was to save/retrieve and iterate over the business objects.
  • Lot of boiler plate code for the db operations.
  • We wanted to write our business logic in less technical and more business fashion.

What it provides

There are two parts to it:

  • Database creation
  • Simple APIs to manipulate your business objects

Links

252 questions
231
votes
16 answers

The number of method references in a .dex file cannot exceed 64k API 17

I am building an app with SugarORM Library but when I try to build the project for API 17 (didn't check for others) it shows build error. Information:Gradle tasks [:app:assembleDebug] :app:preBuild UP-TO-DATE :app:preDebugBuild…
38
votes
21 answers

Android: Sugar ORM No Such Table Exception

I am getting the No Such table exception when i am Using Sugar ORM with GPU image Android Library. I am using Gradle and Android Studio. Once i remove GPU image this issue is solved. So i don't know whats causing this exception. Details about this…
Sheraz Ahmad Khilji
  • 8,300
  • 9
  • 52
  • 84
18
votes
3 answers

Sugar ORM just won't create tables

I am working on a standalone library project that requires persisting a simple model. Here is what my SugarRecord looks like: /** * Keeping track of previously received messages by ID */ public class MessageRequestIdModel extends SugarRecord { …
Angad
  • 2,803
  • 3
  • 32
  • 45
11
votes
6 answers

Parsing a String id with SugarORM and GSON

I'm using GSON to create a SugarRecord object from a json response. The API I'm using returns a field called "id", but the type of "id" is a string, not a long (the backend is using mongo). Below is the code I'm using: Gson gson = new Gson(); // Or…
coder
  • 10,460
  • 17
  • 72
  • 125
9
votes
0 answers

Saving and retrieving data from sugar db without duplication

I'm using Sugar ORM to save and retrieve data persistently. Below is the code that I'm using to store and retrieve data. Slider.deleteAll(Slider.class); JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, Constants.URL,…
user6517192
8
votes
1 answer

Sugar ORM listAll() not showing any data

I'm trying to get data from databse in a listview as shown below. long count = UserTableSugar.count(UserTableSugar.class); if(count>0) { UserTableSugar.listAll(UserTableSugar.class); List userTable =…
Aakash Joshi
  • 147
  • 8
8
votes
3 answers

Sugar ORM for Android cant find my column name

Well I'm trying to select all entities where entitie_id = *some id* I do this with this rule: List nodesugars = NodeSugar.find(NodeSugar.class, "entitie_id = ? ", String.valueOf(nodeid)); I know I should get some results back and I get…
Twizzler
  • 491
  • 1
  • 7
  • 25
8
votes
3 answers

Android Sugar ORM with Existing DB & Custom File Path

I'm perfectly able to use Sugar ORM using provided examples. In my usecase I download a SQLite DB from the server (ETL load for it is in millions of records so has to be done server side). The download saves to a custom path on internal storage. In…
AlexVPerl
  • 7,652
  • 8
  • 51
  • 83
7
votes
2 answers

Jackson + SugarOrm id error

I use jackson and sugar orm and i have some errors when parsing. The id field is located in the json constantly 0. What can I do to fix it? This example my class: @JsonIgnoreProperties(ignoreUnknown = true) public class JsonScienceEvent extends…
Kota1921
  • 2,451
  • 1
  • 10
  • 13
7
votes
2 answers

SugarOrm: OrderBy related table

With SugarORM , I understand in a relationship I can do this public class Book extends SugarRecord { String name; String ISBN; String title; String shortSummary; // defining a relationship Author author; } How then can i do a…
Lukesoft
  • 953
  • 1
  • 12
  • 31
7
votes
1 answer

Android: SugarORM and multidex

I'm working with Android project that uses SugarORM. Now the method limit has increased so much that I have to activate multidex support. But now I have a problem with SugarORM, it creates only the tables that are in classes.dex file. It seems to…
JariA
  • 71
  • 3
6
votes
1 answer

Sugar ORM needs records to be saved every time while unit testing?

I am using Sugar ORM for db and Robolectric for unit testing. To use Sugar ORM with Robolectric i followed this question. Where i put my code below in to startEverTestSugarAppAsFirst method and run. new PersonHandler(new…
orkan
  • 512
  • 1
  • 4
  • 18
6
votes
1 answer

Sugar ORM Migration: Create new table drops/re-creates existing tables

I used SugarORM in my application's first release. Now, I'm working on the 2nd release, which has new tables added to DB. According to SugarORM documentation "Sugar will automatically create tables for new entities, so your migration script only…
Abdurrahman
  • 6,306
  • 3
  • 19
  • 20
6
votes
1 answer

Sugar ORM is not saving data into the database

I am currently using Sugar ORM and Android Async Http Client for my Android application. I read through the documentation of Sugar ORM and did exactly what is written there. My HttpClient is using the singleton pattern and provides methods for…
Mehrad Rafigh
  • 156
  • 1
  • 7
  • 20
5
votes
1 answer

Sugar ORM throws NoSuchTable exception on lollipop

I am developing an Android app. I followed instructions on Sugar ORM website for creating a database table. I do everything the same, I've double checked it. The thing is, when the app is running on Android 5.0 or higher, when a query is executed,…
mehrmoudi
  • 1,096
  • 1
  • 11
  • 22
1
2 3
16 17