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
7
votes
2 answers

GreenDAO: store list of entities in other entity

I am playing around with GreenDAO and I think I like the way it works. I do not like to write SQL code, so this will help me avoid it ;) But still, I think it really is very 'sql'-based thinking of how you set it up. Not sure if this is a bad thing…
Boy
  • 7,010
  • 4
  • 54
  • 68
7
votes
1 answer

DaoException: Entity is detached from DAO context

I have two entities, User and Store. User has many Stores (1:M) relation. I've inserted some stores list into the store table by following code. public void saveStoresToDatabase(Context context, ArrayList storeList) { DevOpenHelper…
Abdul Samad
  • 526
  • 5
  • 13
7
votes
3 answers

How to map Enum in GreenDAO

I've just started using greenDAO. How do I add an Enum property? What I've Thought of: using the addIndex property of an entity. private static void main() { // TODO Auto-generated method stub static Schema blah; Entity unicorn =…
SalicBlu3
  • 1,874
  • 2
  • 19
  • 32
7
votes
1 answer

Android GreenDao - Delete cached objects of a specific entity only

I am using GreenDao ORM in my Android application. As stated here , one can use DaoSession.clear(); in order to clear ALL cached objects of the session. My question is : How about clearing the cached objects of a specific entity (instead of all) ?…
Leeeeeeelo
  • 4,333
  • 3
  • 34
  • 44
6
votes
1 answer

how to delete rows from GreenDao based on condition?

i want to delete rows from a table based on condition. like "delete from Table where Name='Value'" here i am using greenDAO database.
rashmi ranjan
  • 380
  • 1
  • 4
  • 14
6
votes
3 answers

NoClassDefFoundError when trying to run DaoGenerator for GreenDAO

I have an Android Project, using Android Studio 2.3, which uses GreenDAO to generate the classes to interact with the SQLite database. The DaoGenerator project always worked before... but today I just needed to add 2 columns/properties to an Entity…
rgomesbr
  • 242
  • 3
  • 11
6
votes
2 answers

Using more than 1 Database in Greendao with 2 different Schemas - Android

I have 2 databases in the project, one of them created when I open the app, the other is provided with the assets. When DaoSession is generated the DaoSession is created for all models. also the Schema in the gradle file is used for both databases…
MBH
  • 16,271
  • 19
  • 99
  • 149
6
votes
2 answers

GreenDAO Left Join

Consider I have a model : Company 1 - N Person I want to display a list of persons with their names and their company's name. But not every person has a company. I order to avoid that every call to person.getCompany() results in a new SQL query so…
Yohan D
  • 930
  • 2
  • 7
  • 24
6
votes
2 answers

Query using LIKE isn't working using GreenDAO

I have a table which a column is a string with three characters, each character has a value 0 or 1. I'd like to select those rows according to the case. I'd like to perform a query like that: SELECT * FROM Item WHERE group_type LIKE ? ? can be 100…
Douglas Fornaro
  • 2,017
  • 2
  • 22
  • 30
6
votes
0 answers

DBFlow versus GreenDao orm library in Android

I am to pick a DAO library for an app that stores lot of data in SQLite tables with relations. I first choose GreenDao, Since it is being used in many famous apps actively and is quite old, well tested and with bug fixed. Where as DBFlow uses…
Rahul Rastogi
  • 4,486
  • 5
  • 32
  • 51
6
votes
2 answers

GreenDao support for unique constraint on multiple columns

Does GreenDao supports unique constraint on multiple columns? Equivalent of the following: create table projects ( _id integer primary key autoincrement, project_type text, name text, unique (project_type, name) );
dominus
  • 1,082
  • 1
  • 11
  • 14
6
votes
1 answer

greendao string primary keys - how to use

In the greendao FAQs it says "Starting from greenDAO there’s limited support for String primary keys." http://greendao-orm.com/documentation/technical-faq/ I can't find anywhere that says how to do this. I am using Guids as my primary key in a…
BobbyG
  • 536
  • 1
  • 7
  • 20
6
votes
1 answer

GreenDao deep queries with n:m relationships

I have in my application a relationship that is designed like this: and I'm trying to select all the chats that have at least one user as a friend. basically, I want to execute this query: SELECT c.* FROM CHAT c, USER u, UserChats uc WHERE…
thepoosh
  • 12,497
  • 15
  • 73
  • 132
6
votes
4 answers

greendao sort by field in related table

is there a way to sort by a field in a related table with greenDao? E.g. I have a table of cars and a table of drivers. Each car has a driver. Now I want to query for ( e.g. blue ) cars and sort by the name of the driver
ligi
  • 39,001
  • 44
  • 144
  • 244
6
votes
1 answer

Many-to-Many compile error using greendao for android

Problem solved! - I added my solution at the bottom. I have what a think is a fairly simple question but I can't seem to find the answer in the documentation. I am trying to model a many-to-many relationship using greendao for android, however I get…
1 2
3
39 40