ormlite

ORMLite with CursorAdapter in Android

跟風遠走 提交于 2019-11-27 02:44:45
问题 I am modifying my Android app to work with ORMLite, and it currently uses a number of CursorAdapters, which I quite want to keep in an attempt to minimise coding. I'm not 100% sure but t appears that when ORMLite creates an id field in the db, it always uses id , whereas CursorAdapter needs _id . It is possible to get round this using a query like the following: select id as _id ...... but the Dao.queryRaw() method returns a list, not a Cursor, so the way I have done it is to open another

ORMLite update of the database

家住魔仙堡 提交于 2019-11-27 01:56:41
问题 I'm actually developing an app which is using ORMLite library (which is wonderful btw) but I'm a beginner using it. I have a question about the update of the database inside the device. Let's say that someone download my app on the Google Play. Few months later I will certainly populate some tables with new entries. When this person is doing an update of the app, how can I just update the database with my new entries and keep the old ones inside it. To be more clear, imagine that the user

How to use multiple primary keys

隐身守侯 提交于 2019-11-26 21:35:56
问题 I created database, for my android app, witch has 16 tables. I want to use ORMlite mapping. The problem is that I didn't find examples where you have composite id(Multiple primary keys). For example I have table: CREATE TABLE IF NOT EXISTS `Tourist_Guide`.`Cultural_activity` ( `City_Id` INT NOT NULL , `activity_Id` INT NOT NULL , `Cultural_activity_Id` INT NOT NULL AUTO_INCREMENT , `Name_Of_Cultural_activity` VARCHAR(30) NOT NULL , PRIMARY KEY (`Cultural_activity_Id`, `City_Id`, `activity_Id`

Proguard with OrmLite on Android

。_饼干妹妹 提交于 2019-11-26 20:21:02
How should I use proguard with ormlite library on Android? Trying this: -keep class com.j256.** -keepclassmembers class com.j256.** -keep enum com.j256.** -keepclassmembers enum com.j256.** -keep interface com.j256.** -keepclassmembers interface com.j256.** But I get: 03-23 20:23:54.518: E/AndroidRuntime(3032): java.lang.RuntimeException: Unable to start activity ComponentInfo{cz.eman.android.cepro/cz.eman.android.cepro.activity.StationsOverviewActivity}: java.lang.IllegalStateException: Could not find constructor that takes a Context argument for helper class class kb I also tried to add this

Android Studio run configuration for ORMLite config generation

僤鯓⒐⒋嵵緔 提交于 2019-11-26 19:18:39
问题 I'm using Android Studio and want to use ORMLite framework. ORMLite for Android has a mechanism for making DAO creation through table config file. How to setup additional Run Configuration in Android Studio for generating this config? 回答1: I managed to do it, but it was a little bit tricky. I have a class called DatabaseConfigUtil which extends OrmLiteConfigUtil, that I created just by following the ormlite official tutorial, so I'll just assume you did the same and also have that class.

ORMLite's createOrUpdate seems slow - what is normal speed?

喜夏-厌秋 提交于 2019-11-26 16:37:19
问题 Calling the ORMLite RuntimeExceptionDao 's createOrUpdate(...) method in my app is very slow. I have a very simple object ( Item ) with a 2 ints (one is the generatedId ), a String and a double . I test the time it takes (roughly) to update the object in the database (a 100 times) with the code below. The log statement logs: time to update 1 row 100 times: 3069 Why does it take 3 seconds to update an object 100 times, in a table with only 1 row. Is this the normal ORMLite speed? If not, what

How can I reset a autoincrement sequence number in sqlite

不问归期 提交于 2019-11-26 14:17:31
问题 How to update table sqlite_sequence in Ormlite ? I just need update seq. How can I get that table via ORMLite ? EDIT I can't find ORLite tool to do this, so instead I use simple sqlite query. In my class extends OrmLiteSqliteOpenHelper I use SQLiteDatabase to make that update. EDIT2 ;) In my project I persist class Lesson and class WeekDefinition. class Lesson{ @DatabaseField(generatedId=true) private int id; ... } class WeekDefinitions{ @DatabaseField(generatedId=true) private int id;

Proguard with OrmLite on Android

ぃ、小莉子 提交于 2019-11-26 07:36:08
问题 How should I use proguard with ormlite library on Android? Trying this: -keep class com.j256.** -keepclassmembers class com.j256.** -keep enum com.j256.** -keepclassmembers enum com.j256.** -keep interface com.j256.** -keepclassmembers interface com.j256.** But I get: 03-23 20:23:54.518: E/AndroidRuntime(3032): java.lang.RuntimeException: Unable to start activity ComponentInfo{cz.eman.android.cepro/cz.eman.android.cepro.activity.StationsOverviewActivity}: java.lang.IllegalStateException: