爲道的Javadoc刷新()的方法規定:OrmLite不刷新拋出異常沒有結果
拋出: 的SQLException - 任何SQL問題,或者如果數據項不能在表中找到或者如果找到多個具有數據ID的項目。
但是該類com.j256.ormlite.stmt.mapped.MappedRefresh有另外的Javadoc定義並返回結果代碼一路回升到刷新並給用戶。
/**
* Execute our refresh query statement and then update all of the fields in data with the fields from the result.
*
* @return 1 if we found the object in the table by id or 0 if not.
*/
public int executeRefresh(DatabaseConnection databaseConnection, T data, ObjectCache objectCache)
throws SQLException {
@SuppressWarnings("unchecked")
ID id = (ID) idField.extractJavaFieldValue(data);
// we don't care about the cache here
T result = super.execute(databaseConnection, id, null);
if (result == null) {
return 0;
}
// copy each field from the result into the passed in object
for (FieldType fieldType : resultsFieldTypes) {
if (fieldType != idField) {
fieldType.assignField(data, fieldType.extractJavaFieldValue(result), false, objectCache);
}
}
return 1;
}
這是一個錯誤還是Dao.refresh的Javadoc錯誤?
我正在看OrmLite 4.41。
我的回答對你有幫助嗎?如果可以,請接受:http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – Gray 2012-09-26 20:34:39