@Override public void close() { if (scrollableCursor != null) { scrollableCursor.close(); } } }
@Override public boolean hasNext() { return scrollableCursor != null && scrollableCursor.hasNext(); }
void showItems(Cursor items) { if (items.size() > 0) { mAdapter.switchCursor(items); if (R.id.list == mListSwitcher.getNextView().getId()) { mListSwitcher.showNext(); } } else if (R.id.text_empty == mListSwitcher.getNextView().getId()) { mListSwitcher.showNext(); } }
/** * INTERNAL: * Prepare the receiver for execution in a session. */ @Override protected void prepareForRemoteExecution() throws QueryException { super.prepareForRemoteExecution(); checkPrePrepare(getSession()); prepareQuery(); }
/** * PUBLIC: * Use a CursoredStream as the result collection. * @param initialReadSize the initial number of objects to read * @param pageSize the number of objects to read when more objects * are needed from the database */ public void useCursoredStream(int initialReadSize, int pageSize) { setContainerPolicy(new CursoredStreamPolicy(this, initialReadSize, pageSize)); }
/** * Return true if the attribute of the object has already been fetched */ public boolean isAttributeFetched(Object entity, String attributeName) { FetchGroup fetchGroup = ((FetchGroupTracker) entity)._persistence_getFetchGroup(); if (fetchGroup == null) { return true; } return fetchGroup.containsAttributeInternal(attributeName); }
/** * INTERNAL: * Return if the cached object data is sufficiently valid against a fetch group */ public boolean isObjectValidForFetchGroup(Object object, FetchGroup fetchGroup) { FetchGroup groupInObject = ((FetchGroupTracker)object)._persistence_getFetchGroup(); return (groupInObject == null) || groupInObject.isSupersetOf(fetchGroup); }
/** * INTERNAL: * Indicates whether the source query's pessimistic lock scope scope should be extended in the target query. */ protected boolean isExtendingPessimisticLockScope(ObjectBuildingQuery sourceQuery) { // TODO: What if sourceQuery is NOT ObjectLevelReadQuery? Should we somehow handle this? // Or alternatively define ObjectBuildingQuery.shouldExtendPessimisticLockScope() to always return false? return sourceQuery.isLockQuery() && sourceQuery.isObjectLevelReadQuery() && ((ObjectLevelReadQuery)sourceQuery).shouldExtendPessimisticLockScope(); }
@Override public Object getAttributeValueFromObject(Object object) { InMemoryQueryIndirectionPolicy policy = ((ObjectLevelReadQuery)object).getInMemoryQueryIndirectionPolicy(); if (policy.shouldThrowIndirectionException()) { return null; } return policy; }
Query query = em.createNamedQuery("findMe"); Session session = em.unwrap(JpaEntityManager.class).getActiveSession(); DatabaseQuery databaseQuery = ((EJBQueryImpl)query).getDatabaseQuery(); databaseQuery.prepareCall(session, new DatabaseRecord()); String sqlString = databaseQuery.getSQLString();
@Override public String extractQueryString(Query query) { return ((JpaQuery<?>) query).getDatabaseQuery().getJPQLString(); }
@Override public T next() { if (scrollableCursor == null) { throw new NoSuchElementException("No ScrollableCursor"); } return (T) scrollableCursor.next(); }
public ReportQueryResult(ReportQuery query, AbstractRecord row, Vector toManyResults) { super(); this.names = query.getNames(); buildResult(query, row, toManyResults); }
/** * INTERNAL: * Called if shouldExtendPessimisticLockScopeInTargetQuery() is true. * Adds locking clause to the target query to extend pessimistic lock scope. */ protected void extendPessimisticLockScopeInTargetQuery(ObjectLevelReadQuery targetQuery, ObjectBuildingQuery sourceQuery) { targetQuery.setLockMode(sourceQuery.getLockMode()); }
/** * PUBLIC: * Use a CursoredStream as the result collection. * @param initialReadSize the initial number of objects to read * @param pageSize the number of objects to read when more objects * are needed from the database */ public void useCursoredStream(int initialReadSize, int pageSize) { setContainerPolicy(new CursoredStreamPolicy(this, initialReadSize, pageSize)); }
/** * INTERNAL: * Set temporary map of batched objects. */ public void setBatchObjects(Map<Object, Object> batchObjects) { getBatchFetchPolicy().setBatchObjects(batchObjects); }
/** * INTERNAL: * Return temporary map of batched objects. */ public Map<Object, Object> getBatchObjects() { return getBatchFetchPolicy().getBatchObjects(); }
/** * PUBLIC: * Use a CursoredStream as the result collection. * @param initialReadSize the initial number of objects to read * @param pageSize the number of objects to read when more objects * are needed from the database * @param sizeQuery a query that will return the size of the result set; * this must be set if an expression is not used (i.e. custom SQL) */ public void useCursoredStream(int initialReadSize, int pageSize, ValueReadQuery sizeQuery) { setContainerPolicy(new CursoredStreamPolicy(this, initialReadSize, pageSize, sizeQuery)); }
public Object getAttributeValueFromObject(Object object) { InMemoryQueryIndirectionPolicy policy = ((ObjectLevelReadQuery)object).getInMemoryQueryIndirectionPolicy(); if (policy.shouldThrowIndirectionException()) { return null; } return policy; }
/** * PUBLIC: * Use a CursoredStream as the result collection. * @param initialReadSize the initial number of objects to read * @param pageSize the number of objects to read when more objects * are needed from the database * @param sizeQuery a query that will return the size of the result set; * this must be set if an expression is not used (i.e. custom SQL) */ public void useCursoredStream(int initialReadSize, int pageSize, ValueReadQuery sizeQuery) { setContainerPolicy(new CursoredStreamPolicy(this, initialReadSize, pageSize, sizeQuery)); }