Questions tagged [greendao]

greenDAO is an object/relational mapping (ORM) tool for Android. It offers an object oriented interface to the relational database SQLite. ORM tools like greenDAO do many repetitive tasks for you and offer a simple interface to your data.

greenDAO's primary features:

  • Fast & slim: designed for Android and SQLite
  • Support for entity relations
  • Query builder
  • Code generation

Links:

592 questions
6
votes
1 answer

How to combine multiple greenDAO Tx operations into one transaction?

My application consumes remote REST API and populates local db with greenDao. I have a service with AsyncTask class: @Override protected Void doInBackground(Void... params) { insert100RowsIntheFirstTable(); …
midnight
  • 3,420
  • 3
  • 36
  • 58
6
votes
2 answers

Why GreenDAO doesn't support LIKE operator completely?

GreenDAO just supported one position of LIKE operator. It was " LIKE ?" I wanna fetch records with variety of this operator. such as, " LIKE %?", " LIKE ?%" and " LIKE %?%". but it doesn't supported by GreenDAO. Also I've used queryRaw() and…
Omid Nazifi
  • 5,235
  • 8
  • 30
  • 56
5
votes
1 answer

How to create database from Assets in Android using GreenDao ORM library

I am using GreenDao orm library for creating database, it works good with the First sample for Creating Database, from within the code. Now the problem is I can't find any documentation or anything related to the Database copying from Assets Folder…
Some one Some where
  • 777
  • 1
  • 8
  • 26
5
votes
0 answers

How to make many-to-many relation query in GreenDAO with source property other than primary key?

Let's assume we have following entities: Item: class Item { ... @Index(unique=true) private String guid; ... @ToMany @JoinEntity(entity = JoinItemsWithTags.class, sourceProperty = "itemGuid", targetProperty = "tagName") private…
Bringoff
  • 1,093
  • 1
  • 10
  • 24
5
votes
2 answers

How to get distinct values from BoxStore Objectbox database in android

I cant able to write a query to get distinct values in green dao's Objectbox database in android
Anil Kumar GN
  • 339
  • 1
  • 8
5
votes
2 answers

Which one is better if we compare Realm and GreenDAO Local Storage Databases for Android? What is reason that making one of them Slower?

I am developing an android App and want to use Database for Local Storage.I have Searched on internet and found some comparisons between Local Storage Databases. But I have to Choose between Realm and GreenDAO. So please suggest me for which one to…
Flow.NK
  • 368
  • 1
  • 8
  • 17
5
votes
2 answers

Could not allocate CursorWindow '/pos-db' of size 2097152 due to error -24

Exception Information cannot open file at line 30176 of [00bb9c9ce4] (14) os_unix.c:30176: (24) open(/data/data/c/databases/pos-db-journal) - (14) cannot open file at line 30176 of [00bb9c9ce4] (14) os_unix.c:30176: (24)…
chao.zhang
  • 61
  • 4
5
votes
0 answers

Set codeBeforeField for attribute before GreenDAO relation

I have recently started using GreenDao for my Android app where I am creating a Category entity which should have multiple Category entities as children. Therefore I am using a Tree Relation as follows: Entity category =…
5
votes
1 answer

In GreenDao, build a join query with OR instead of AND

I generated an SQLite DB with GreenDao v2.1.0. Here is its diagram (a tiny piece of it) A CONTACT can have many phone numbers. I want to make a search query : list all contacts whose GIVEN_NAME or FAMILY_NAME or PHONE.NUMBER contains a specific…
5
votes
1 answer

Adding array as a property in greenDAO entity

I have the following JSON response that I wish to map into my entity: { "name": "Andrew", "stop_ids": [ "956", "957", "958" ] } I know that I can create a one to many relationship if I create another entity with my stop_ids, but is there a…
5
votes
2 answers

DaoConfig init failure with greendao on Samsung Devices with Android 5.0

Crashlytics is reporting a lot of crashes in greendao: > Caused by de.greenrobot.dao.DaoException: Could not init DAOConfig > at de.greenrobot.dao.internal.DaoConfig.(DaoConfig.java:94) > at…
5
votes
2 answers

How to do database migration unit test between releases

I have an Android app with a database with version 1. I added a data column in one table and idi a migration into a new release. The problem I have is how to do unit tests for this. I needed to check if old data are correct inserted in the new…
IrApp
  • 1,823
  • 5
  • 24
  • 42
5
votes
0 answers

Background thread locking UI for several seconds

I'm experiencing a weird issue. I have my app's 2-way sync code running inside a ScheduledThreadPoolExecutor. The code iterates over a large list of objects from the server's response and saves them to the local database (SQLite with GreenDAO). The…
fehbari
  • 1,429
  • 2
  • 16
  • 22
5
votes
1 answer

How do I load all fields from a database and sort the result after one row with GreenDao?

I want to load all entities from a sqlite database with greendao and sort the result. I can load all entities with loadAll but this doesn't gives me a guarantee about the sorting of the resulting list.
Janusz
  • 187,060
  • 113
  • 301
  • 369
5
votes
2 answers

Upgrading database using my OpenHelper in greendao

I use GreenDao as my ORM. I want migrate schema from oldversion to new version. I use this link to implement my mygration. So I wrote my own OpenHelper class and put it to another package. I Implement onUpgrade method like this: public class…
SerCna
  • 278
  • 2
  • 12