On GAE with Spring/JDO after saving 2 entities (in transaction).
On calling getById
- entities fetched from data storage.
On calling getCount()
returns "0"
and - on calling getAll()
- returns empty collection.
@Override
public Long getCount() {
return ((Integer) getJdoTemplate().execute(new JdoCallback() {
@Override
public Object doInJdo(PersistenceManager pm) throws JDOException {
Query q = pm.newQuery(getPersistentClass());
q.setResult("count(this)");
return q.execute();
}
})).longValue();
}
@Override
public void saveOrUpdate(T entity) {
getJdoTemplate().makePersistent(entity);
}
@Override
public List<T> getAll() {
return new ArrayList<T>(getJdoTemplate().find(getPersistentClass()));
}