GAE, JDO, count() doesn't work ?
- by NilsBor
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.
plz help me !
DAO:
@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 getAll() {
return new ArrayList(getJdoTemplate().find(getPersistentClass()));
}