0
我有以下兩個類,其中Document擴展了一個提供幫助函數的Abstract類,其中一個是「find」方法,它構建查詢以基於一些簡單的邏輯來查找記錄。ActiveJDBC和Java泛型導致
public abstract class AbstractTable<T extends AbstractTable<T>> extends Model {
...
public T find (String[] columns) {
String whereClause = "";
List<Object> whereClauseData = new ArrayList<Object>();
for (String column : columns) {
Object data = this.get(column);
if (data == null) {
whereClause += column + " is null AND ";
} else {
whereClause += column + " = ? AND ";
whereClauseData.add (data);
}
}
return findFirst (whereClause.substring(0, whereClause.length() - 5), whereClauseData.toArray());
}
}
public class Document extends AbstractTable<Document> {
...
public Document findExistingObject(Document document) {
String[] columns = new String[] {"court_case_id", "number", "name", "file_date"};
return super.find (columns);
}
}
當運行該代碼,而「findExistingObject」方法被調用上的文檔,我收到此異常:在線程「主」 org.javalite.activejdbc.InitException
例外: 未能確定型號類名稱,您確定型號已被 檢測過?
我已經完全確定我已經安裝了這些類。當我將AbstractTable中的代碼移動到Document中時,一切都很完美。我希望有人能提供一些建議或幫助,這可能會告訴我我做錯了什麼。
在此先感謝。