greendao

INSTALL_FAILED_DEXOPT when using GreenDao

放肆的年华 提交于 2020-01-16 01:04:29
问题 Background I wanted to simplify the usage of DB in an Android app. For this, I've compared some third party libraries that create a DAO layer. I've come up with a nice library called "GreenDao" (presentation about it here) . The website shows that it's faster than other competitors (like ORMLite) and is optimized for Android. The problem For some reason, on some device (usually old devices, with GB) , I get the next console error when trying to install the app: Installation error: INSTALL

How to solve greenDAO “No such table exists error” when doing an InsertOrReplace?

人盡茶涼 提交于 2020-01-03 21:15:33
问题 I am using greenDAO and I have successfully generated all necessary classes and entities and I can see that my table has been created, however after putting breakpoints on the line to replace, I get an error telling me "No such table exists error". try { appTimeUsageDao.insertOrReplace(appStats); //} catch (DaoException e) { } catch (Exception e) { Log.e("Error", "Some exception occurred", e); Log.e("APP_TAG", Log.getStackTraceString(e)); } 回答1: For me this issue was related to this

Query dynamically with greenDao

ぃ、小莉子 提交于 2020-01-03 19:46:07
问题 I need to verify some conditions to create a complete query: QueryBuilder qb = getMyObjDao().queryBuilder(); if ( someCondition ) qb.where(MyObjDao.Properties.Prop1.eq(someValue)); else qb.whereOr(MyObjDao.Properties.Prop2.eq(someValue),MyObjDao.Properties.Prop2.eq(someValue)); if ( someOtherCondition ) qb.where(MyObjDao.Properties.Prop3.eq(someValue)); else qb.whereOr(MyObjDao.Properties.Prop4.eq(someValue)); So is it possible to concatenate query builder conditions and create query builder

Query dynamically with greenDao

邮差的信 提交于 2020-01-03 19:43:06
问题 I need to verify some conditions to create a complete query: QueryBuilder qb = getMyObjDao().queryBuilder(); if ( someCondition ) qb.where(MyObjDao.Properties.Prop1.eq(someValue)); else qb.whereOr(MyObjDao.Properties.Prop2.eq(someValue),MyObjDao.Properties.Prop2.eq(someValue)); if ( someOtherCondition ) qb.where(MyObjDao.Properties.Prop3.eq(someValue)); else qb.whereOr(MyObjDao.Properties.Prop4.eq(someValue)); So is it possible to concatenate query builder conditions and create query builder

GreenDAO support multiple relations between tables

孤人 提交于 2020-01-02 00:59:47
问题 I've been trying to create a DB model using GreenDAO. the problem started when I tried to create more than one relationship between a different tables. basically, I have a Message table, a Conversation table and a User table. the User has a list of messages, and the message has a parent conversation. I tried writing this code for creating the DB: private static void addUser(Schema schema) { user = schema.addEntity("User"); userId = user.addIdProperty().getProperty(); user.addStringProperty(

Are there greenDAO thread safety best practices?

痴心易碎 提交于 2020-01-01 04:04:01
问题 I'm having a go with greenDAO and so far it's going pretty well. One thing that doesn't seem to be covered by the docs or website (or anywhere :( ) is how it handles thread safety. I know the basics mentioned elsewhere, like "use a single dao session" (general practice for Android + SQLite), and I understand the Java memory model quite well. The library internals even appear threadsafe, or at least built with that intention. But nothing I've seen covers this: greenDAO caches entities by

ORM performance: is greenDAO faster than ORMLite?

强颜欢笑 提交于 2019-12-31 08:14:28
问题 I've been using ORMLite in my application and I was considering whether to move to greenDAO. Performance is a huge part of that decision, and greenDAO's Features page says: For the same given entity, greenDAO inserts and updates entities over 2 times faster, and loads entities 4.5 times faster for loading entities than ORMLite. ... (Figures and chart updated 10-23-2011) I thought ORMLite's config file generation step should remove the need for reflection at runtime. The ORMLite changlog

Android - SQLite - no such column error (greenDAO)

坚强是说给别人听的谎言 提交于 2019-12-31 05:13:49
问题 I created my table structure with greenDAO and when updating the following table, I'm getting the follwing error: android.database.sqlite.SQLiteException: no such column: BODY_LOG_ENTRY._id: , while compiling: UPDATE BODY_LOG_ENTRY SET 'BODY_LOG_ENTRY._id'=?, 'BODY_LOG_ENTRY.FK_DAY'=?, 'BODY_LOG_ENTRY.DAY_ORDER'=?, 'BODY_LOG_ENTRY.DESCRIPTION'=?, 'BODY_LOG_ENTRY.BODY_WEIGHT'=?, 'BODY_LOG_ENTRY.BODY_SIZE'=?, 'BODY_LOG_ENTRY.BODY_FAT_FORMULA'=?, 'BODY_LOG_ENTRY.BODY_FAT_FORMULA_DATA1'=?, 'BODY

greendao string primary keys - how to use

走远了吗. 提交于 2019-12-30 09:28:09
问题 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 server application, and want to be able to generate new data remotely from an android device and upload this back to the server. The database on the android device is in sqlite and uses greenDAO to generate POJOs and data access layer. I am using Guids

Custom type in GreenDao with POJO class

a 夏天 提交于 2019-12-25 16:54:14
问题 This is my sample JSON: { "open":true, "total_products":100, "product":[ { "p_id":1, "price":"5.00", "name":"blah one" }, { "p_id":2, "price":"15.00", "name":"blah two" }, ... ] } This is my POJO class: @Entity(nameInDb = "products") public class ProductsPOJO { @SerializedName("open") @Property(nameInDb = "open") private boolean open; @SerializedName("total_products") @Property(nameInDb = "total_products") private Long total_products; @Convert(converter = ProductConverter.class, columnType =