List of usage examples for org.hibernate ScrollMode FORWARD_ONLY
ScrollMode FORWARD_ONLY
To view the source code for org.hibernate ScrollMode FORWARD_ONLY.
Click Source Link
From source file:org.n52.sos.ds.hibernate.dao.ObservationDAO.java
License:Open Source License
public ScrollableResults getNotMatchingSeries(Set<Long> procedureIds, Set<Long> observablePropertyIds, Set<Long> featureIds, GetObservationRequest request, Set<String> features, Criterion temporalFilterCriterion, Session session) throws OwsExceptionReport { Criteria c = getObservationCriteriaFor(request, features, temporalFilterCriterion, null, session); addAliasAndNotRestrictionFor(c, procedureIds, observablePropertyIds, featureIds); return c.setReadOnly(true).scroll(ScrollMode.FORWARD_ONLY); }
From source file:org.n52.sos.ds.hibernate.dao.ObservationDAO.java
License:Open Source License
public ScrollableResults getNotMatchingSeries(Set<Long> procedureIds, Set<Long> observablePropertyIds, Set<Long> featureIds, GetObservationRequest request, Set<String> features, Session session) throws OwsExceptionReport { Criteria c = getObservationCriteriaFor(request, features, null, null, session); addAliasAndNotRestrictionFor(c, procedureIds, observablePropertyIds, featureIds); return c.setReadOnly(true).scroll(ScrollMode.FORWARD_ONLY); }
From source file:org.n52.sos.ds.hibernate.dao.series.AbstractSeriesObservationDAO.java
License:Open Source License
public ScrollableResults getSeriesNotMatchingSeries(Set<Long> seriesIDs, GetObservationRequest request, Set<String> features, Criterion temporalFilterCriterion, Session session) throws OwsExceptionReport { Criteria c = getSeriesObservationCriteriaFor(request, features, temporalFilterCriterion, null, session) .createAlias(SeriesObservation.SERIES, "s"); c.add(Restrictions.not(Restrictions.in("s." + Series.ID, seriesIDs))); c.setProjection(Projections.property(SeriesObservation.SERIES)); return c.setReadOnly(true).scroll(ScrollMode.FORWARD_ONLY); }
From source file:org.n52.sos.ds.hibernate.dao.series.AbstractSeriesObservationDAO.java
License:Open Source License
public ScrollableResults getSeriesNotMatchingSeries(Set<Long> seriesIDs, GetObservationRequest request, Set<String> features, Session session) throws OwsExceptionReport { Criteria c = getSeriesObservationCriteriaFor(request, features, null, null, session) .createAlias(SeriesObservation.SERIES, "s"); c.add(Restrictions.not(Restrictions.in("s." + Series.ID, seriesIDs))); return c.setReadOnly(true).scroll(ScrollMode.FORWARD_ONLY); }
From source file:org.n52.sos.ds.hibernate.dao.series.AbstractSeriesObservationDAO.java
License:Open Source License
/** * Query series observations for GetObservation request, features, and filter criterion (typically a temporal filter) or * an indeterminate time (first/latest). This method is private and accepts all possible arguments for request-based * getSeriesObservationFor. Other public methods overload this method with sensible combinations of arguments. * /*from w w w.j ava 2 s.co m*/ * @param request * GetObservation request * @param features * Collection of feature identifiers resolved from the request * @param filterCriterion * Criterion to apply to criteria query (typically a temporal filter) * @param sosIndeterminateTime * Indeterminate time to use in a temporal filter (first/latest) * @param session * @return {@link ScrollableResults} of Series observations that fits * @throws OwsExceptionReport */ protected ScrollableResults getStreamingSeriesObservationsFor(GetObservationRequest request, Collection<String> features, Criterion filterCriterion, SosIndeterminateTime sosIndeterminateTime, Session session) throws OwsExceptionReport { return getSeriesObservationCriteriaFor(request, features, filterCriterion, sosIndeterminateTime, session) .setReadOnly(true).scroll(ScrollMode.FORWARD_ONLY); }
From source file:org.n52.sos.ds.hibernate.dao.series.AbstractSeriesValueDAO.java
License:Open Source License
/** * Query streaming value for parameter as {@link ScrollableResults} * /* w ww . java2s .c o m*/ * @param request * {@link GetObservationRequest} * @param series * Datasource series id * @param temporalFilterCriterion * Temporal filter {@link Criterion} * @param session * Hibernate Session * @return Resulting {@link ScrollableResults} * @throws HibernateException * If an error occurs when querying the {@link AbstractValue}s * @throws OwsExceptionReport * If an error occurs when querying the {@link AbstractValue}s */ public ScrollableResults getStreamingSeriesValuesFor(GetObservationRequest request, long series, Criterion temporalFilterCriterion, Session session) throws OwsExceptionReport { return getSeriesValueCriteriaFor(request, series, temporalFilterCriterion, session) .scroll(ScrollMode.FORWARD_ONLY); }
From source file:org.n52.sos.ds.hibernate.dao.series.AbstractSeriesValueDAO.java
License:Open Source License
/** * Query streaming value for parameter as {@link ScrollableResults} * //from w w w . j ava 2s. co m * @param request * {@link GetObservationRequest} * @param series * Datasource series id * @param session * Hibernate Session * @return Resulting {@link ScrollableResults} * @throws OwsExceptionReport * If an error occurs when querying the {@link AbstractValue}s */ public ScrollableResults getStreamingSeriesValuesFor(GetObservationRequest request, long series, Session session) throws OwsExceptionReport { return getSeriesValueCriteriaFor(request, series, null, session).scroll(ScrollMode.FORWARD_ONLY); }
From source file:org.n52.sos.ds.hibernate.dao.ValueDAO.java
License:Open Source License
/** * Query streaming value for parameter as {@link ScrollableResults} * //w w w. j ava 2 s .com * @param request * {@link GetObservationRequest} * @param procedure * Datasource procedure id * @param observableProperty * Datasource procedure id * @param featureOfInterest * Datasource procedure id * @param temporalFilterCriterion * Temporal filter {@link Criterion} * @param session * Hibernate Session * @return Resulting {@link ScrollableResults} * @throws HibernateException * If an error occurs when querying the {@link AbstractValue}s * @throws OwsExceptionReport * If an error occurs when querying the {@link AbstractValue}s */ public ScrollableResults getStreamingValuesFor(GetObservationRequest request, long procedure, long observableProperty, long featureOfInterest, Criterion temporalFilterCriterion, Session session) throws HibernateException, OwsExceptionReport { return getValueCriteriaFor(request, procedure, observableProperty, featureOfInterest, temporalFilterCriterion, session).scroll(ScrollMode.FORWARD_ONLY); }
From source file:org.n52.sos.ds.hibernate.dao.ValueDAO.java
License:Open Source License
/** * Query streaming value for parameter as {@link ScrollableResults} * //from www.ja v a 2s . c o m * @param request * {@link GetObservationRequest} * @param procedure * Datasource procedure id * @param observableProperty * Datasource procedure id * @param featureOfInterest * Datasource procedure id * @param session * Hibernate Session * @return Resulting {@link ScrollableResults} * @throws OwsExceptionReport * If an error occurs when querying the {@link AbstractValue}s */ public ScrollableResults getStreamingValuesFor(GetObservationRequest request, long procedure, long observableProperty, long featureOfInterest, Session session) throws OwsExceptionReport { return getValueCriteriaFor(request, procedure, observableProperty, featureOfInterest, null, session) .scroll(ScrollMode.FORWARD_ONLY); }
From source file:org.ng200.openolympus.services.TaskService.java
License:Open Source License
@PreAuthorize(SecurityExpressionConstants.IS_ADMIN) @Transactional/*w w w . ja v a2 s . com*/ public void rejudgeTask(final Task task) throws ExecutionException, IOException { final Lock lock = task.writeLock(); lock.lock(); try { this.verdictRepository.flush(); this.solutionRepository.flush(); this.verdictRepository.deleteBySolutionTask(task); this.verdictRepository.flush(); final StatelessSession session = ((Session) this.entityManager.getDelegate()).getSessionFactory() .openStatelessSession(); try { final Query query = session.createQuery("from Solution where task_id=:taskID"); query.setParameter("taskID", task.getId()); query.setFetchSize(Integer.valueOf(1000)); query.setReadOnly(false); final ScrollableResults results = query.scroll(ScrollMode.FORWARD_ONLY); try { while (results.next()) { final Solution solution = (Solution) results.get(0); this.testingService.testSolutionOnAllTests(solution); } } finally { results.close(); } } finally { session.close(); } } finally { lock.unlock(); } }