p4j5: Source For The Paginator Java EE 5 Pattern Available 📎
The usage is very straight-forward - it works like an iterator:
CustomerQuery query = (CustomerQuery)PortableRemoteObject.narrow(remote,CustomerQuery.class);
while(query.hasNext()){
List<Customer> customers = query.next();
System.out.println("Size: " + customers.size());
for (Customer customer : customers) {
System.out.println("Customer: " +customer);
}
}
The Paginator is realized as a stateful EJB 3 which works with JPA's Entity Manager. The whole source is available in p4j5.