GAE, JDO, count() doesn't work ?
Posted
by NilsBor
on Stack Overflow
See other posts from Stack Overflow
or by NilsBor
Published on 2010-03-13T12:45:51Z
Indexed on
2010/03/13
12:55 UTC
Read the original article
Hit count: 401
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())); }
© Stack Overflow or respective owner