Codota Logo
Criteria.scroll
Code IndexAdd Codota to your IDE (free)

How to use
scroll
method
in
org.hibernate.Criteria

Best Java code snippets using org.hibernate.Criteria.scroll (Showing top 20 results out of 315)

  • Common ways to obtain Criteria
private void myMethod () {
Criteria c =
  • Codota IconSession session;Class persistentClass;session.createCriteria(persistentClass)
  • Smart code suggestions by Codota
}
origin: hibernate/hibernate-orm

@Test
public void testScrollCriteria() {
  Session session = openSession();
  Transaction t = session.beginTransaction();
  Course course = new Course();
  course.setCourseCode("HIB");
  course.setDescription("Hibernate Training");
  session.persist(course);
  session.flush();
  session.clear();
  ScrollableResults sr = session.createCriteria(Course.class).setReadOnly( true ).scroll();
  assertTrue( sr.next() );
  course = (Course) sr.get(0);
  assertNotNull(course);
  assertTrue( session.isReadOnly( course ) );
  sr.close();
  session.delete(course);
  t.commit();
  session.close();
}

origin: debop/hibernate-redis

@Override
public ScrollableResults scroll(Criteria criteria) {
 return criteria.scroll();
}
origin: debop/hibernate-redis

@Override
public ScrollableResults scroll(Criteria criteria, ScrollMode scrollMode) {
 return criteria.scroll(scrollMode);
}
origin: ezbz/projectx

@Override
public ScrollableResults scroll(final ScrollMode scrollMode) throws HibernateException {
 return criteria.scroll();
}
origin: ezbz/projectx

@Override
public ScrollableResults scroll() throws HibernateException {
 return criteria.scroll();
}
origin: TGAC/miso-lims

@Override
public ScrollableResults scroll(ScrollMode scrollMode) throws HibernateException {
 return backingCriteria.scroll(scrollMode);
}
origin: TGAC/miso-lims

@Override
public ScrollableResults scroll() throws HibernateException {
 return backingCriteria.scroll();
}
origin: openmrs/openmrs-core

ScrollableResults results = session.createCriteria(type).setFetchSize(1000).scroll(ScrollMode.FORWARD_ONLY);
int index = 0;
while (results.next()) {
origin: 52North/SOS

public static <T> ScrollableIterable<T> fromCriteria(Criteria c) {
  return new ScrollableIterable<>(c.scroll());
}
origin: org.n52.sensorweb.sos/hibernate-common

public static <T> ScrollableIterable<T> fromCriteria(Criteria c) {
  return new ScrollableIterable<>(c.scroll());
}
origin: stackoverflow.com

 Criteria criteria = getCurrentSession().createCriteria(LargeVolumeEntity.class);
criteria.add(Restrictions.eq("archived", Boolean.FALSE));
criteria.setReadOnly(true);
criteria.setCacheable(false);
List<E> result = new IterableListScrollableResults<E>(getCurrentSession(),
    criteria.scroll(ScrollMode.FORWARD_ONLY));
for(E entity : result) {
  dumpEntity(file, entity);
}
origin: stackoverflow.com

 Criteria criteria = getCurrentSession().createCriteria(LargeVolumeEntity.class);
criteria.add(Restrictions.eq("archived", Boolean.FALSE));
criteria.setReadOnly(true);
criteria.setCacheable(false);
List<E> result = new IterableListScrollableResults<E>(getCurrentSession(),
    criteria.scroll(ScrollMode.FORWARD_ONLY));
for(E entity : result) {
  dumpEntity(file, entity);
}
origin: com.revolsys.open/com.revolsys.open.orm.hibernate

/**
 * Construct a new HibernateQueryPager.
 * 
 * @param criteria The Hibernate criteria.
 */
public HibernateCriteriaPager(final Criteria criteria) {
 this.criteria = criteria;
 final ScrollableResults scrollableResults = criteria.scroll();
 scrollableResults.last();
 this.numResults = scrollableResults.getRowNumber() + 1;
}
origin: debop/hibernate-redis

@Override
public ScrollableResults scroll(DetachedCriteria dc) {
 return dc.getExecutableCriteria(getSession()).scroll();
}
origin: debop/hibernate-redis

@Override
public ScrollableResults scroll(DetachedCriteria dc, ScrollMode scrollMode) {
 return dc.getExecutableCriteria(getSession()).scroll(scrollMode);
}
origin: 52North/SOS

protected void deleteOldValues(String id, Session session) {
  Criteria criteria = session.createCriteria(getHibernateEntityClass());
  criteria.createCriteria(I18nEntity.PROPERTY_ENTITY)
      .add(Restrictions.eq(DescribableEntity.IDENTIFIER, id));
  ScrollableResults scroll = null;
  try {
    scroll = criteria.scroll();
    while (scroll.next()) {
      @SuppressWarnings("unchecked")
      H h18n = (H) scroll.get()[0];
      session.delete(h18n);
    }
  } finally {
    if (scroll != null) {
      scroll.close();
    }
  }
  session.flush();
}
origin: org.n52.sensorweb.sos/hibernate-common

protected void deleteOldValues(String id, Session session) {
  Criteria criteria = session.createCriteria(getHibernateEntityClass());
  criteria.createCriteria(I18nEntity.PROPERTY_ENTITY)
      .add(Restrictions.eq(DescribableEntity.IDENTIFIER, id));
  ScrollableResults scroll = null;
  try {
    scroll = criteria.scroll();
    while (scroll.next()) {
      @SuppressWarnings("unchecked")
      H h18n = (H) scroll.get()[0];
      session.delete(h18n);
    }
  } finally {
    if (scroll != null) {
      scroll.close();
    }
  }
  session.flush();
}
origin: stackoverflow.com

 Criteria criteria = ...;
ScrollableResults scroll = criteria.scroll();
Object[] firstRow = scroll.get();  // or use other methods for getting the data
scroll.last();
Object[] lastRow = scroll.get();
origin: stackoverflow.com

final Criteria criteria = session.createCriteria(clazz);  
     List<Criterion> restrictions = factory.assemble(command.getFilter());
     for (Criterion restriction : restrictions)
       criteria.add(restriction);
     criteria.add(Restrictions.conjunction());
     if(this.projections != null)
       criteria.setProjection(factory.loadProjections(this.projections));
     criteria.addOrder(command.getDir().equals("ASC")?Order.asc(command.getSort()):Order.desc(command.getSort()));
     ScrollableResults scrollable = criteria.scroll(ScrollMode.SCROLL_INSENSITIVE);
     if(scrollable.last()){//returns true if there is a resultset
       genericDTO.setTotalCount(scrollable.getRowNumber() + 1);
       criteria.setFirstResult(command.getStart())
           .setMaxResults(command.getLimit());
       genericDTO.setLineItems(Collections.unmodifiableList(criteria.list()));
     }
     scrollable.close();
     return genericDTO;
origin: org.infinispan/infinispan-cachestore-jpa

@Override
public Flowable<K> publishKeys(Predicate<? super K> filter) {
 return Flowable.using(() -> {
   EntityManager emStream = emf.createEntityManager();
   Session session = emStream.unwrap(Session.class);
   Criteria criteria = session.createCriteria(configuration.entityClass()).setProjection(Projections.id()).setReadOnly(true);
   if (setFetchSizeMinInteger) {
    criteria.setFetchSize(Integer.MIN_VALUE);
   }
   ScrollableResults results = criteria.scroll(ScrollMode.FORWARD_ONLY);
   return new KeyValuePair<>(emStream, results);
 }, kvp -> {
   ScrollableResults results = kvp.getValue();
   return Flowable.fromIterable(() -> new ScrollableResultsIterator(results, filter)
   );
 }, kvp -> {
   try {
    kvp.getValue().close();
   } finally {
    kvp.getKey().close();
   }
 });
}
org.hibernateCriteriascroll

Javadoc

Get the results as an instance of ScrollableResults.

Popular methods of Criteria

  • list
    Get the results.
  • add
    Add a Criterion to constrain the results to be retrieved.
  • uniqueResult
    Convenience method to return a single instance that matches the query, or null if the query returns
  • addOrder
    Add an Order to the result set.
  • setProjection
    Used to specify that the query results will be a projection (scalar in nature). Implicitly specifies
  • setMaxResults
    Set a limit upon the number of objects to be retrieved.
  • setFirstResult
    Set the first result to be retrieved.
  • setResultTransformer
    Set a strategy for handling the query results. This determines the "shape" of the query result.
  • createAlias
    Join an association using the specified join-type, assigning an alias to the joined association. The
  • createCriteria
    Create a new Criteria, "rooted" at the associated entity, using the specified join type.
  • setFetchMode
    Specify an association fetching strategy for an association or a collection of values.
  • setCacheable
    Enable caching of this query result, provided query caching is enabled for the underlying session fa
  • setFetchMode,
  • setCacheable,
  • setFetchSize,
  • setLockMode,
  • setReadOnly,
  • setCacheRegion,
  • setTimeout,
  • setCacheMode,
  • setFlushMode

Popular in Java

  • Finding current android device location
  • getSupportFragmentManager (FragmentActivity)
  • notifyDataSetChanged (ArrayAdapter)
  • requestLocationUpdates (LocationManager)
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
  • LinkedHashMap (java.util)
    Hash table and linked list implementation of the Map interface, with predictable iteration order. Th
  • Reference (javax.naming)
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.This exception may include information for locating the er
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now