|
Oracle Fusion Middleware Java API Reference for Oracle TopLink 11g Release 1 (11.1.1) B32476-03 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CursoredCollection
CursoredCollection is an interface that conforms to Collection while providing Cursor behaviour. This interface is returned from an EJB finder method that uses TopLink CursoredStream support. This is TopLink's way of providing cursored support to EJB2.0 finders. Although all methods are provided, only the following are supported: isEmpty() size() iterator() Example: Execute a finder that reads 150 projects. Read the first 50 as singles, then, read the next 50 in bulk. This simulates a screen paging down.
import oracle.toplink.ejb.cmp.*;
import java.util.*;
CursoredIterator cursoredIterator;
ProjectHome projectHome = getProjectHome();
//begin a transaction. Leave this open until done
getTransaction().begin();
System.out.println("Finding multiple Projects...");
Vector projects = new Vector();
cursoredIterator = (CursoredIterator)projectHome.findByNameCursored("proj%").iterator();
for (int index = 0; index < 50; i++) {
Project project = (Project)cursoredIterator.next();
projects.addElement(project);
}
System.out.println("Get the rest all at once ...");
Vector projectsNext50 = cursoredIterator.next(50);
cursoredIterator.close();
//commit transaction, now that we're done
getTransaction().commit();
CursoredStream
,
CursoredIterator
Method Summary |
---|
Methods inherited from interface java.util.Collection |
---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |