My need is to implement database rowset paging behaviour.
i.e I want to create an Extent when session created and then on page
request browse the dataset from the last point.
The problem:
JDOExtent is not serializable and hence the code below throws an
extent.
Please suggest an alternative approach.
public class AgentInfoDao {
static final String q ="SELECT FROM " + AgentInformation.class.getName
() + " order by appointmentDate asc";
Extent<AgentInformation> extent = null;
Iterator<AgentInformation> resultIterator;
public void sessionCreated() {
PersistenceManager pm = PMF.get().getPersistenceManager();
extent = pm.getExtent(AgentInformation.class, false);
Query query = pm.newQuery(q);
query.setCandidates(extent);
Collection<AgentInformation> result =
(Collection)query.execute();
resultIterator = result.iterator();
}
public List<AgentInformation> fetchNextSet(int setCount){
log.info("Next Set of " + setCount);
List<AgentInformation> set = new ArrayList<AgentInformation>();
int c=0;
while(c < setCount && resultIterator.hasNext()){
// do something...
}
return set;
}
public void sessionDestroyed() {
extent.closeAll();
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---