を拡張した場合、私は次のテーブルがある -Ormlite - コンストラクタ呼び出し失敗BaseDaoImplが
public interface A_Dao extends Dao<A, String>{}
public interface B_Dao extends Dao<B, String>{}
public class B_DaoImpl extends BaseDaoImpl<User, String> implements B_Dao {
public B_DaoImpl(ConnectionSource connectionSource) throws SQLException {
super(connectionSource, B.class);
}
}
public class A_DaoImpl extends BaseDaoImpl<User, String> implements A_Dao {
public A_DaoImpl(ConnectionSource connectionSource) throws SQLException {
super(connectionSource, A.class);
}
}
データベースヘルパーは次のようにこれらのテーブルの
@DatabaseTable(tableName="b", daoClass=B_DaoImpl.class)
public class B {
@DatabaseField
public String b1 ;
public B(){
// For Ormlite
}
}
@DatabaseTable(tableName="a", daoClass=A_DaoImpl.class)
public class A {
@DatabaseField
public String a1 ;
@DatabaseField(foreign=true)
public B b;
public A(){
// For Ormlite
}
}
を、関連するダオとDaoImplは、次のとおりです。今
public class DatabaseHelperImpl extends OrmLiteSqliteOpenHelper implements DatabaseHelper {
private A_DaoImpl aDao = null;
private B_DaoImpl bDao = null;
public B_DaoImpl getBDao() throws SQLException {
if (bDao == null) {
bDao = getDao(B.class);
}
return bDao;
}
public A_DaoImpl getA() throws SQLException {
if (aDao == null) {
aDao = getDao(A.class);
}
return aDao;
}
}
、私が呼び出すしよう -
次のエラーとのADao aDao = databaseHelper.getA();
そのエラーアウト:
今Could not call the constructor in class class A_DaoImpl
、私は中foriegnキーがない場合、 - Aが公衆BのBが含まれていない場合、すなわち、それが正常に動作します。私がここで紛失しているものがありますか?
ありがとうございます。
例外をすべて転記できますか?その例外の原因情報があるはずですか?また、ORMLiteのどのバージョンを使用していますか? – Gray
ええ、それは貢献と最高の答えについての "正しい"についてではありません。良い答えがない場合は、自分で答える必要があります。 – Gray
私は最高の答え:)グレイありがとうございます。 – Koran