On May 30, 2008, at 11:41 AM, James Carman wrote:
On Fri, May 30, 2008 at 11:38 AM, David Nedrow <[EMAIL PROTECTED]>
wrote:
On May 30, 2008, at 11:20 AM, James Carman wrote:
What is the type of item.getModelObject(). Have you run it
through a
debugger (or just simply put in a println)?
Yes, I had done that first, thinking maybe I didn't understand how
ListView
worked via the Model.
The object returned by item.getModelObject().toString() is...
Try doing, item.getModelObject().getClass().toString() (unless that's
what you meant to type).
Sorry, that's what I had done but the getClass() didn't make it in to
my message. ;)
Can we see an example method from your DAO?
What persistence library are you using (hibernate, jpa, jdo, etc.)?
This is jpa via toplink.
Here's the method I'm calling in the Protocol class (note that the
logger does fire in findAll())....
/**
* Find all Protocol entities.
*
* @param rowStartIdxAndCount
* Optional int varargs. rowStartIdxAndCount[0]
specifies the the
* row index in the query result-set to begin
collecting the
* results. rowStartIdxAndCount[1] specifies the the
maximum
* count of results to return.
* @return List<Protocol> all Protocol entities
*/
@Transactional(readOnly = true)
@SuppressWarnings("unchecked")
@Override
public List<Protocol> findAll(final int... rowStartIdxAndCount) {
logger.info("finding all Protocol instances");
try {
final String queryString = "select model from Protocol
model";
return getJpaTemplate().executeFind(new JpaCallback() {
@Override public Object doInJpa(EntityManager em)
throws PersistenceException {
Query query = em.createQuery(queryString);
if ((rowStartIdxAndCount != null) &&
(rowStartIdxAndCount.length > 0)) {
int rowStartIdx = Math.max(0,
rowStartIdxAndCount[0]);
if (rowStartIdx > 0) {
query.setFirstResult(rowStartIdx);
}
if (rowStartIdxAndCount.length > 1) {
int rowCount = Math.max(0,
rowStartIdxAndCount[1]);
if (rowCount > 0) {
query.setMaxResults(rowCount);
}
}
}
return query.getResultList();
}
});
} catch (RuntimeException re) {
logger.error("find all failed", re);
throw re;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]