greendao

Best way to select row with following scenario using greenDao?

大城市里の小女人 提交于 2019-12-24 19:23:54
问题 I have 3 tables : Manager: manager_id, taluka_name Employee: employee_id, employee_manager_id Target: target_id, target_employee_id Now i have to show a ListView of all the targets taluka_name wise. I am using greenDao for the interaction with the SQlite database. This is the process i have tried , It is taking too long using the method i have used: Step1: Get Manager ID for the taluka name from the DB. Step2: Get Employee for the Target table->Employee ID. Step3: Get Manager ID from the

greenDAO简单使用

无人久伴 提交于 2019-12-24 18:29:00
集成 // In your root build . gradle file: buildscript { repositories { jcenter ( ) mavenCentral ( ) / / add repository } dependencies { classpath 'com.android.tools.build:gradle:3.1.1' classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2' // add plugin } } / / In your app projects build . gradle file: apply plugin: 'com.android.application' apply plugin: 'org.greenrobot.greendao' // apply plugin dependencies { implementation 'org.greenrobot:greendao:3.2.2' // add library } greendao { / / 数据库版本号 schemaVersion 1 //设置DaoMaster、DaoSession、Dao包名,也就是要放置这些类的包的路径。 daoPackage 'com.yechaoa.test.dao' /

Integrating SQLCipher with greenDAO

允我心安 提交于 2019-12-24 09:35:07
问题 How to encrypt sqlite database in android with sqlchipher while using greenDao orm. I have searched this many time in SO , but didn't find any working solution . 回答1: In your greendao generator module add this dependency compile 'org.greenrobot:greendao-generator-encryption:2.2.0' So the build.gradle file your generator module will look like this apply plugin: 'java' dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'org.greenrobot:greendao-generator-encryption:2.2.0' }

Exclude package from jacoco code coverage for Android

陌路散爱 提交于 2019-12-23 03:42:21
问题 I'm trying to exclude generated files by GreenDao framework, which placed in a package named dao, from my code coverage report generated by Jacoco, but creating a custom task like following doesn't work. def coverageSourceDirs = [ '../app/src/main/java' ] task jacocoTestReport(type: JacocoReport, dependsOn: "testDebug") { group = "Reporting" description = "Generate Jacoco coverage reports after running tests." reports { xml.enabled = true html.enabled = true } classDirectories = fileTree( dir

how to use DISTINCT in GreenDao

我只是一个虾纸丫 提交于 2019-12-23 02:57:18
问题 I want to query distinct rows in SqlLite, I am not getting how to query using GreenDao library for android. List<activity> activities = activityDao.queryRaw("SELECT DISTINCT "+Properties.Date_time +" FROM "+activityDao.getTablename()+" WHERE "+Properties.Contact_number+ " = "+phonenumber); ERROR: 11-13 21:12:50.915 9320-10428/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #4 Process: com.ficean.android.ficean, PID: 9320 java.lang.RuntimeException: An error occured while executing

GreenDao asynchronously loadAll methood

不羁岁月 提交于 2019-12-23 02:35:00
问题 I can successfully insert rows asynchronously using GreeDAO 's AsyncSession like this: getMyObjectDao().getSession().startAsyncSession().insertOrReplaceInTx(MyObject.class, list); How can I load all objects from db into ArrayList asynchronously. So far I have tried below code but its not working: 1- <List>items = getBoxDao(c).getSession().startAsyncSession().loadAll(MyObject.class) ; 2- @Override public void onAsyncOperationCompleted(AsyncOperation operation) { String operationIs = null;

Creating more than 1 *.db file with greenDao android ORM library

▼魔方 西西 提交于 2019-12-22 12:23:40
问题 I'm using greenDao library (http://greendao-orm.com/) for managing my android app database. Everything works fine, but I can't find a way to create many *.db files. All my tables are in the same single file i.ex. books.db. Is there a way to tell greenDao to put books related tables in books.db and authors related tables in authors.db? Thanks in advance for help. EDIT: Ok I've solved the problem. You can make many *.db files by putting them in different schemas and then use generatedAll for

Adding custom code to greenDAO entities

吃可爱长大的小学妹 提交于 2019-12-22 07:25:51
问题 I want to add some custom code to my greenDAO entities. I saw there is something like protected regions. But I don't like the idea to check in the generated classes to my git repository. I'd like to use inheritance for this. i.e. I have an entity User . So I want greenDAO to generate a class called UserBase . This I want to extend by User and implement a method like this: public String getFullName() { return this.first + " " + this.last; } Where first and last are managed properties. But I

Adding custom code to greenDAO entities

心已入冬 提交于 2019-12-22 07:25:02
问题 I want to add some custom code to my greenDAO entities. I saw there is something like protected regions. But I don't like the idea to check in the generated classes to my git repository. I'd like to use inheritance for this. i.e. I have an entity User . So I want greenDAO to generate a class called UserBase . This I want to extend by User and implement a method like this: public String getFullName() { return this.first + " " + this.last; } Where first and last are managed properties. But I

DaoException: Entity is detached from DAO context

一世执手 提交于 2019-12-22 05:17:23
问题 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<Store> storeList) { DevOpenHelper helper = new DaoMaster.DevOpenHelper(context, "notes-db", null); SQLiteDatabase db = helper.getWritableDatabase(); DaoMaster daoMaster = new DaoMaster(db); DaoSession daoSession = daoMaster.newSession(); StoreDao storeDao = daoSession.getStoreDao();