ormlite

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

 ̄綄美尐妖づ 提交于 2019-12-12 08:29:38
问题 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 {

In ormlite, How can I have a foriegn field and a field column?

旧街凉风 提交于 2019-12-12 02:49:41
问题 My Entity is something like this. @Data public class Comment implements Persistable<Long>, CBHistoryTable { @Id private Long tid; // sid and pid is required for serialized to json @DatabaseField private Long pid; @DatabaseField private Long sid; @DatabaseField(foreign = true, foreignColumnName = "sid", columnName = "sid") private Article article; @DatabaseField(foreign = true, foreignColumnName = "pid", columnName = "tid") private Comment parent; } When I insert, will cause the SQL Syntax

NullPointerException crash reports using static DatabaseHelper

自古美人都是妖i 提交于 2019-12-12 02:06:20
问题 I’m receiving random NullPointerException crash reports from Google that can’t be reproduced. I’m using a static reference to a class that extends OrmLiteSqliteOpenHelper. The helper is initialised in the main class that extends SherlockFragmentActivity. if (DatabaseHelper.getInstance() == null) { DatabaseHelper.setInstance(this.getApplicationContext()); } At first I though it may occur when the device is rotated or sent to the background. But no amount of testing has been able to recreate

Where is my database file created

╄→гoц情女王★ 提交于 2019-12-11 23:25:28
问题 This is my file dataSqliteHelper and when I run the first time, the data file is created but I don't know where is it to get it and open it with a tool and view the file. public class DataSQLiteHelper extends OrmLiteSqliteOpenHelper { public static final String DATABASE_NAME = "ventasdb.db"; private static final int DATABASE_VERSION = 1; private Context mContext; private Dao<Customer, Integer> customerDao; public DataSQLiteHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE

IllegalStateException: Could not find constructor that hast just a (Context) argument for helper class null

扶醉桌前 提交于 2019-12-11 19:34:38
问题 Hi i am getting the error my logcat is: 08-12 12:49:07.095: E/AndroidRuntime(4151): FATAL EXCEPTION: main 08-12 12:49:07.095: E/AndroidRuntime(4151): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.kns.expense.activty/com.kns.expense.activty.AddExpenseActivity}: java.lang.IllegalStateException: Could not find constructor that hast just a (Context) argument for helper class null 08-12 12:49:07.095: E/AndroidRuntime(4151): at android.app.ActivityThread

How select a period of date from sqlite

。_饼干妹妹 提交于 2019-12-11 15:02:42
问题 I have a table in SQLite that has three fields (id, fromDate, toDate, uid). I want to select rows that has created in a specific dates. User select the period of time (from date/ to date). How I can query with ORMLite? 回答1: Sqlite does not have a Date type(supported types) There is some dateTime functions, i think that any of function will meet your requirement... The easier solution will be to convert you date to a timestamp and compare the timestamp. 来源: https://stackoverflow.com/questions

How do you update a foreign field in Ormlite?

て烟熏妆下的殇ゞ 提交于 2019-12-11 13:18:29
问题 I tried update(Object) , update(PreparedUpdate) , executeRaw(String) , updateRaw(String) , and even tried directly using the helper class then using getData(String query) . But my table's foreign field is still not updated. Any thoughts why this is happening? 回答1: I found out that I am using the method update(Object) on other methods while passing an outdated instance of the object I am trying to update. So once I use the actual update(PreparedUpdate) method, I am reverting the object back to

Android + ORMLite + java.sql.Timestamp

邮差的信 提交于 2019-12-11 11:27:01
问题 I have an Android project which uses ORMLite. All works fine, but for some fields in database it uses java.sql.Timestamp as field type. It worked fine on ORMLite 4.10, which I used before. But now I need to update ORMLite, and have a problem.. When I updated ORMLite to newer version and run it, app throws exception: W/System.err( 615): java.sql.SQLException: ORMLite can't store unknown class class java.sql.Timestamp for field 'createDate'. Serializable fields must specify dataType=DataType

Trying write a query with ORMLite?

与世无争的帅哥 提交于 2019-12-11 07:11:39
问题 I'm trying write a query using ORMLite. I need this query check a id of custommer in other entity. How could I do it ? Entities @DatabaseTable(tableName = "custommer") public class Custommer{ @DatabaseField(generatedId = true) private Integer id; @DatabaseField private String name; @DatabaseField private Sale sale; //gets sets } @DatabaseTable(tableName = "sale") public class Sale{ @DatabaseField(generatedId = true) private Integer id; @DatabaseField private Custommer custommer;

class not found exception on android when I use extends OrmLiteBaseActivity<Database>

落爺英雄遲暮 提交于 2019-12-11 05:26:33
问题 when I use extends OrmLiteBaseActivity<Database> instead of extends Activity I get following errors in my logcat . 08-17 17:05:28.497: W/dalvikvm(8818): Unable to resolve superclass of Lcom/example/sample/MainActivity; (427) 08-17 17:05:28.537: W/dalvikvm(8818): Link of class 'Lcom/example/sample/MainActivity;' failed 08-17 17:05:28.537: D/AndroidRuntime(8818): Shutting down VM 08-17 17:05:28.568: W/dalvikvm(8818): threadid=1: thread exiting with uncaught exception (group=0x409c01f8) 08-17 17