-1
我使用的是GAE Object mapping framework(和內置我們的應用程序在其周圍),此代碼工作無法獲得實體走出數據存儲的主要
Key key = put(thing);
Thing thing = get(Thing.class, key);
上面代碼的偉大工程。
現在,有這種putInTransaction
方法:
@Override
public Key putInTransaction(Object object) {
Transaction tx = _ds.beginTransaction(_options);
Key result = null;
try {
result = put(object);
} catch (Exception e) {
e.printStackTrace();
tx.rollback();
} finally {
if (tx.isActive()) {
tx.rollback();
}
}
return result;
}
其中我比較從put(thing)
和putInTransaction(thing)
碼鍵和具有相同kind
,id
,name
和appIdNamespace
Key
現在的問題是,當使用密鑰get(Thing.class,key)
對putInTranscation(thing)
進行JUnit測試時,它不會返回實體w hile當測試與put(thing)
它工作正常。 這裏有什麼問題?
我沒有看到你在任何地方提交交易?! – koma
哇很好。 – xybrek