Extent
The Extent instance has two possible uses:
Query
477478479480481482483484485486487
try { tx.begin(); Extent extent = pm.getExtent( BuildResult.class, true ); pm.getFetchPlan().addGroup( BUILD_RESULT_WITH_DETAILS_FETCH_GROUP ); Query query = pm.newQuery( extent ); String parameters = "int projectId, long fromDate";
534535536537538539540541542543544
try { tx.begin(); Extent extent = pm.getExtent( BuildResult.class, true ); Query query = pm.newQuery( extent ); query.declareParameters( "int projectId" );
576577578579580581582583584585586
try { tx.begin(); Extent extent = pm.getExtent( BuildResult.class, true ); Query query = pm.newQuery( extent ); query.declareParameters( "int projectId, int buildNumber" );
614615616617618619620621622623624
698699700701702703704705706707708
try { tx.begin(); Extent extent = pm.getExtent( BuildResult.class, true ); Query query = pm.newQuery( extent ); String filter = "this.project.buildNumber == this.buildNumber";
555657585960616263646566676869
BatchTestRunner.run(CloseOfExtentIteratorIsIteratorSpecific.class); } /** */ public void test() { Extent ex = getExtent(); beginTransaction(); Iterator it1 = ex.iterator(); ex.close(it1); int count = countIterator(ex.iterator()); if (count != 2) { fail(ASSERTION_FAILED, "iterating Employees after close of first iterator; counted " + count + " instances; should be 2"); } Query q = getPM().newQuery(ex);
391392393394395396397398399400401
/** */ protected Collection getAllObjects(PersistenceManager pm, Class pcClass) { Collection col = new Vector() ; Query query = pm.newQuery(); query.setClass(pcClass); Extent candidates = null; try { candidates = pm.getExtent(pcClass, false); } catch (JDOException ex) { if (debug) logger.debug("Exception thrown for getExtent of class " + pcClass.getName());
158159160161162163164165166167168169
createAndModifyInstance(); // iterate the extent and use the object in a new datastore transaction pm.currentTransaction().setOptimistic(false); pm.currentTransaction().begin(); Extent e = pm.getExtent(StateTransitionObj.class, false); for (Iterator i = e.iterator(); i.hasNext();) { StateTransitionObj next = (StateTransitionObj)i.next(); if (oid.equals(pm.getObjectId(next))) { // found instance int value = next.readField(); if (value != originalValue){
272273274275276277278279280281282
private boolean doPersistentInstancesExist() { boolean ret; Transaction t = pm.currentTransaction(); t.begin(); Extent e = pm.getExtent(StateTransitionObj.class, false); Iterator iter = e.iterator(); ret = iter.hasNext(); t.rollback(); return ret; }
620621622623624625626627628629630631
} /** */ public StateTransitionObj getHollowInstance() { Extent extent = pm.getExtent(StateTransitionObj.class, false); Iterator iter = extent.iterator(); if( !iter.hasNext() ){ if (debug) logger.debug("Extent for StateTransitionObj should not be empty"); return null; }