Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Can';无法检索持久化对象_Java_Android_Orm - Fatal编程技术网

Java Can';无法检索持久化对象

Java Can';无法检索持久化对象,java,android,orm,Java,Android,Orm,我的DatabaseHelper类如下所示: package de.wlochowitz.myapp; 进口附加费; 进口紫薇; 导入speedition.modelFactory; 导入speedition.warenahme; 导入android.content.Context; 导入java.sql.SQLException; 导入android.database.sqlite.SQLiteDatabase; 导入android.util.Log; 导入com.j256.ormlite.a

我的DatabaseHelper类如下所示:

package de.wlochowitz.myapp;
进口附加费;
进口紫薇;
导入speedition.modelFactory;
导入speedition.warenahme;
导入android.content.Context;
导入java.sql.SQLException;
导入android.database.sqlite.SQLiteDatabase;
导入android.util.Log;
导入com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
导入com.j256.ormlite.dao.dao;
导入com.j256.ormlite.dao.RuntimeExceptionDao;
导入com.j256.ormlite.support.ConnectionSource;
导入com.j256.ormlite.table.TableUtils;
公共类DatabaseHelper扩展了OrmLiteSqliteOpenHelper{
私有静态最终字符串数据库\u NAME=“mydb.db”;
私有静态最终int数据库_VERSION=1;
私有Dao fahrerDao=null;
私有Dao lagerstaetteDao=null;
私有Dao warenahnamedao=null;
私有RuntimeExceptionDao fahrerRuntimeDao=null;
私有运行时dao lagerstaetteRuntimeDao=null;
私有运行时exceptiondao warenahnameruntimedao=null;
私有模型工厂mmf=null;
公共数据库助手(上下文){
super(上下文、数据库名称、null、数据库版本);
}
公共void dropTables(SQLiteDatabase db,ConnectionSource connSrc)引发SQLException{
TableUtils.dropTable(connectionSource,Fahrer.class,true);
TableUtils.dropTable(connectionSource,Lagerstaette.class,true);
dropTable(connectionSource,warenahname.class,true);
}
public void createTables(SQLiteDatabase db,ConnectionSource connSrc){
试一试{
Log.i(DatabaseHelper.class.getName(),“onCreate”);
TableUtils.createTable(connSrc,Fahrer.class);
createTable(connSrc,Lagerstaette.class);
createTable(connSrc,warenahname.class);
}捕获(SQLE异常){
Log.e(DatabaseHelper.class.getName(),“无法创建数据库”);
抛出新的运行时异常(e);
}
Fahrer-fahrerA=addFahrer(“A”,1);
Fahrer fahrerB=addFahrer(“B”,2);
Fahrer fahrerC=addFahrer(“C”,3);
Fahrer fahrerD=addFahrer(“D”,4);
Lagerstaette lagerstaette1=添加Lagerstaette(20,1);
Lagerstaette-lagerstaette2=addLagerstaette(40,2);
Lagerstaette-lagerstaette3=addLagerstaette(90,3);
Lagerstaette lagerstaette4=添加Lagerstaette(30,4);
addwarenahme(1,fahrerA,lagerstaette1,lagerstaette1.getWarenkapazitaet());
addwarenahme(2,fahreb,lagerstaette2,lagerstaette2.getwarenkapazitate());
addwarenahme(3,fahrec,lagerstaette3,lagerstaette3.getwarenkapazitate());
addwarenahme(4,fahred,lagerstaette4,lagerstaette4.getwarenkapazitate());
}
public void onCreate(SQLiteDatabase db,ConnectionSource connSrc){
创建表(db、connSrc);
}
public Fahrer addFahrer(最终字符串名、最终长id){
Fahrer Fahrer=getModelFactory().createFahrer();
fahrer.setName(名称);
fahrer.setId(id);
getFahrerDataDao().create(fahrer);
回程费勒;
}
公共拉格尔斯泰特公寓(最终室内设计,最终长id){
Lagerstaette Lagerstaette=getModelFactory().createLagerstaette();
紫薇;黄花紫薇(黄花紫薇);
紫薇;刚毛(id);
getLagerstaetteDataDao().create(lagerstaette);
回归紫薇;
}
公共WARENAHME ADDWARENAHME(最终长id,最终Fahrer Fahrer,
最终拉格斯泰特拉格斯泰特,最终内卡帕齐塔特){
WARENAHME WARENAHME=getModelFactory().CreateWARENAHME();
warenahme.setId(id);
瓦伦纳姆·塞特法赫勒(法赫勒);
瓦伦纳姆。塞特拉格斯泰特(拉格斯泰特);
瓦伦纳姆·塞卡帕齐塔特(卡帕齐塔特);
getwarenahmedatadao().create(warenahme);
返回瓦伦纳姆;
}
public void onUpgrade(SQLiteDatabase db,ConnectionSource connSrc,int oldVersion,
int(新版本){
试一试{
Log.i(DatabaseHelper.class.getName(),“onUpgrade”);
下拉表(db、connSrc);
onCreate(db,connectionSource);
}捕获(SQLE异常){
Log.e(DatabaseHelper.class.getName(),“无法删除数据库”,e);
抛出新的运行时异常(e);
}
}
公共模型工厂getModelFactory(){
如果(mmf==null){
mmf=新的ModelFactory();
}
返回mmf;
}
公共Dao getFahredao()引发SQLException{
if(fahrerDao==null){
fahrerDao=getDao(Fahrer.class);
}
返回fahrerDao;
}
公共Dao getLagerstaetteDao()引发SQLException{
if(lagerstaetteDao==null){
lagerstaetteDao=getDao(Lagerstaette.class);
}
回归紫薇;
}
public Dao getwarenahmedao()引发SQLException{
if(warenahnamedao==null){
warenahnamedao=getDao(warenahname.class);
}
返回瓦伦那麦道;
}
公共运行时DAO getFahrerDataDao()除外{
if(fahrerRuntimeDao==null){
fahrerRuntimeDao=getRuntimeExceptionDao(Fahrer.class);
}
返回fahrerRuntimeDao;
}
公共运行时DAO getLagerstaetteDataDao()除外{
if(lagerstaetteRuntimeDao==null){
lagerstaetteRuntimeDao=getRuntimeExceptionDao(Lagerstaette.class);
}
退紫薇;
}
公共运行时Getwarenahmedatadao()除外{
if(warenahnameruntimedao==null){
warenahnameruntimedao=getRuntimeExceptionDao(warenahname.class);
}
返回Warenahnameruntimedao;
}
公众假期结束(){
super.close();
fahrerDao=null;
fahrerRuntimeDao=