ormlite

How to build query with selecting by value of foreign object's field

老子叫甜甜 提交于 2019-12-04 03:31:37
问题 What is the best way for querying by using the value of foreign object's field? Suppose I have these three classes. UnitResult class which describes amount of Units: @DatabaseTable public class UnitResult { public static final String ID_FIELD_NAME = "id"; public static final String UNIT_COLUMN_NAME = "unit"; public static final String RESULT_COLUMN_NAME = "result"; @DatabaseField(generatedId = true, columnName = ID_FIELD_NAME) public Integer id; @DatabaseField(foreign = true, canBeNull =

Android Studio E/dalvikvm﹕ Could not find class '.DatabaseHelper', referenced from method .DatabaseManager

大城市里の小女人 提交于 2019-12-04 02:47:31
Hello I'm getting this error using Android Studio on runtime but only on devices with an SDK version <= 19. Everything compiles ok but I get this error on my databaseHelper Class. java.lang.NoClassDefFoundError: Here is my app build.gradle: apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion '23.0.1' useLibrary 'org.apache.http.legacy' defaultConfig { minSdkVersion 11 targetSdkVersion 23 versionCode 1 versionName "1.0" multiDexEnabled true } buildTypes { release { minifyEnabled true } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs')

How to use the ORMLite query builder to get the total records in a table

自作多情 提交于 2019-12-03 22:20:19
Similar to select count(*) from tablename; what should be query in ORMLITE i tried something like int total = dao.queryBuilder().("select count(*)"); How to use the ORMLite query builder to get the total records in a table ORMLite has a Dao.countOf() method that returns the total number of rows in a table: long numRows = dao.countOf(); You can also count the number of rows in a custom query by calling the countOf() method on the Where or QueryBuilder object. // count the number of lines in this custom query long numRows = dao.queryBuilder().where().eq("name", "Joe Smith").countOf(); PoeHaH for

Is there any way to use OrmLite with Postgres hstores?

南笙酒味 提交于 2019-12-03 21:16:01
问题 We're currently using a PostgreSQL database and OrmLite. We now have a use case for using an Postgres hstore, but can't find any way of accessing that table through OrmLite. I'd prefer to avoid opening a separate database connection just to select and insert to that one table, but I'm not seeing any other options. At the very least I'd like a handle to the existing connection OrmLite is using so I can reuse it to build a prepared statement, but I haven't found a way to get a java.sql

lightweight ORM instead of hibernate - robust and agile [closed]

给你一囗甜甜゛ 提交于 2019-12-03 20:15:56
Closed . This question is opinion-based. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it can be answered with facts and citations by editing this post . Closed 6 years ago . i googled the phrase "lightweight ORM for j2ee" and find this page http://java-source.net/open-source/persistence from one of results. my goal is to find an ORM Framework that is lighter than Hibernate and also delivers some of hibernates features that are most important to me, for example: auto table generating and lazy initializing, and don't give me hard time

One-To-Many relationship in ORMLite Android

混江龙づ霸主 提交于 2019-12-03 17:31:25
问题 How do I implement one-many relationship in ORMLite Android? please find the example public class A { private String name; @DatabaseField (foreign = true, foreignAutoRefresh = true, columnName = "A") private B b; @DatabaseField(columnName = "author") private String authorName; } public class B { @DatabaseField(generatedId = true, columnName = "id") private long id; @DatabaseField(columnName = "name") private String name; @ForeignCollectionField Collection<A> aees; } B has collection of A. I

Timezone problems when reading date from Ormlite

纵然是瞬间 提交于 2019-12-03 17:09:29
问题 I discovered that the dates being read through Ormlite don't return correctly when changing my device's time zone. For instance, when switching from Amsterdam time to London time, the date should shift forward an hour. However, when reading the date from the database, it returns the same time, but now in the London time zone. I'm storing my field as follows: @DatabaseField(canBeNull = true) private Date registration; 回答1: Looking into the database, I discovered that Ormlite by default stores

Problems with OrmLite and proguard obfuscation

↘锁芯ラ 提交于 2019-12-03 13:58:37
问题 When I use Proguard on project with OrmLite. I recieve this error : java.lang.RuntimeException: Unable to start activity ComponentInfo{com.package.name/com.package.name.activities.StartActivity}: java.lang.IllegalStateException: Could not find OpenHelperClass because none of the generic parameters of class class com.package.name.activities.StartActivity extends OrmLiteSqliteOpenHelper. You should use getHelper(Context, Class) instead. I've tried all recomendation from Proguard with OrmLite on

Deleting using ormlite on android?

风流意气都作罢 提交于 2019-12-03 11:09:08
问题 I have a Client bean , @DatabaseField(columnName = "client_id",generatedId = true,useGetSet = true) private Integer clientId; @DatabaseField(columnName = "client_nom",useGetSet = true) private String clientNom; @DatabaseField(columnName = "city_id",foreign = true,useGetSet = true) private City city; and a City bean , @DatabaseField(columnName = "city_id",generatedId = true,useGetSet = true) private Integer cityId; @DatabaseField(columnName = "city_name",useGetSet = true) private String

Proguard with OrmLite on Android

匿名 (未验证) 提交于 2019-12-03 09:06:55
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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