Android의 OrmLite에 약간의 문제가 있습니다.Android 및 OrmLite : OnUpgrade 실패
데이터베이스 버전을 증가시킬 때 onUpgrade
메서드가 OrmLite 도우미에서 예상대로 호출됩니다. 업그레이드 후, onCreate
방법이라고 나는이 예외 얻을 수있다 :
11-24 10:09:45.720: ERROR/AndroidConnectionSource(390): connection saved
[email protected] is not the one
being cleared [email protected]
지워진 연결이 저장된 것과 동일하지 왜 단서가 없다합니다.
또한 데이터베이스 기능 (삽입 ...)을 OrmLite Helper 클래스에 넣었습니다. 어쩌면 이것이 문제가 될 수 있겠습니까?!?
A는 내 헬퍼 클래스에서 니펫을 :
public class OrmLiteDBProvider extends OrmLiteSqliteOpenHelper
implements IEntityProvider, IDBProvider {
//snip
@Override
public void onCreate(SQLiteDatabase db, ConnectionSource connectionSource) {
try {
Log.i(OrmLiteDBProvider.class.getName(), "Creating database and tables");
TableUtils.createTable(connectionSource, OrgManaged.class);
} catch (SQLException e) {
Log.e(OrmLiteDBProvider.class.getName(),
"Can't create database and tables", e);
throw new RuntimeException(e);
}
}
@Override
public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource,
int oldVersion, int newVersion) {
try {
Log.i(OrmLiteDBProvider.class.getName(),
"Database version changed. Dropping database.");
TableUtils.dropTable(connectionSource, OrgManaged.class, true);
// after we drop the old databases, we create the new ones
onCreate(db);
} catch (SQLException e) {
Log.e(OrmLiteDBProvider.class.getName(), "Can't drop databases", e);
throw new RuntimeException(e);
}
}
나는 내가 부족 간단하게 뭔가 생각합니다.
미리 감사드립니다.
언급하는 것을 잊었습니다 : OrmLite 버전 4.5 – saxos
전체 예외 스택 saxos를 게시 할 수 있습니까? 감사. – Gray