Package org.hibernate

Examples of org.hibernate.Criteria.scroll()


      }

      criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);

      if (isScrollableResultSet()) {
        return (Iterator<?>) new ScrollIterator(criteria.scroll());
      } else {
        List<?> list = criteria.list();
        return list.iterator();
      }
    } catch (HibernateException he) {
View Full Code Here


    }

    public int getRowCountByExample(User exampleUser, String... ignoreProperty) {

        Criteria crit = prepareExampleCriteria(exampleUser, null, false, ignoreProperty);
        ScrollableResults cursor = crit.scroll();
        cursor.last();
        int count = cursor.getRowNumber() + 1;
        cursor.close();
        return count;
    }
View Full Code Here

      .createCriteria( indexedType )
      .setProjection( Projections.id() )
      .setCacheable( false )
      .setFetchSize( idFetchSize );

    ScrollableResults results = criteria.scroll( ScrollMode.FORWARD_ONLY );
    ArrayList<Serializable> destinationList = new ArrayList<Serializable>( batchSize );
    long counter = 0;
    try {
      while ( results.next() ) {
        Serializable id = (Serializable) results.get( 0 );
View Full Code Here

      .createCriteria( indexedType )
      .setProjection( Projections.id() )
      .setCacheable( false )
      .setFetchSize( idFetchSize );

    ScrollableResults results = criteria.scroll( ScrollMode.FORWARD_ONLY );
    ArrayList<Serializable> destinationList = new ArrayList<Serializable>( batchSize );
    long counter = 0;
    try {
      while ( results.next() ) {
        Serializable id = (Serializable) results.get( 0 );
View Full Code Here

            Criteria criteria = session.createCriteria(configuration.entityClass()).setReadOnly(true)
                  .setProjection(Projections.id());
            if (setFetchSizeMinInteger) {
               criteria.setFetchSize(Integer.MIN_VALUE);
            }
            results = criteria.scroll(ScrollMode.FORWARD_ONLY);

            while (results.next()) {
               Object o = results.get(0);
               batch.add(o);
               if (batch.size() == configuration.batchSize()) {
View Full Code Here

                  .setProjection(Projections.id());
            if (setFetchSizeMinInteger) {
               criteria.setFetchSize(Integer.MIN_VALUE);
            }

            keys = criteria.scroll(ScrollMode.FORWARD_ONLY);
            while (keys.next()) {
               if (taskContext.isStopped())
                  break;
               final Object key = keys.get(0);
               if (filter != null && !filter.accept(key)) {
View Full Code Here

                  .add(Restrictions.le(MetadataEntity.EXPIRATION, currentTime)).setProjection(Projections.id());
            if (setFetchSizeMinInteger) {
               criteria.setFetchSize(Integer.MIN_VALUE);
            }

            metadataKeys = criteria.scroll(ScrollMode.FORWARD_ONLY);
            ArrayList<MetadataEntityKey> batch = new ArrayList<MetadataEntityKey>((int) configuration.batchSize());
            while (metadataKeys.next()) {
               MetadataEntityKey mKey = (MetadataEntityKey) metadataKeys.get(0);
               batch.add(mKey);
               if (batch.size() == configuration.batchSize()) {
View Full Code Here

            Criteria criteria = session.createCriteria(configuration.entityClass()).setReadOnly(true)
                  .setProjection(Projections.id());
            if (setFetchSizeMinInteger) {
               criteria.setFetchSize(Integer.MIN_VALUE);
            }
            results = criteria.scroll(ScrollMode.FORWARD_ONLY);

            while (results.next()) {
               Object o = results.get(0);
               batch.add(o);
               if (batch.size() == configuration.batchSize()) {
View Full Code Here

            Session session = emStream.unwrap(Session.class);
            Criteria criteria = strategy.getCriteria(session).setReadOnly(true);
            if (setFetchSizeMinInteger) {
               criteria.setFetchSize(Integer.MIN_VALUE);
            }
            results = criteria.scroll(ScrollMode.FORWARD_ONLY);
            try {
               while (results.next()) {
                  if (taskContext.isStopped())
                     break;
                  Object result = results.get(0);
View Full Code Here

                  .add(Restrictions.le(MetadataEntity.EXPIRATION, currentTime)).setProjection(Projections.id());
            if (setFetchSizeMinInteger) {
               criteria.setFetchSize(Integer.MIN_VALUE);
            }

            metadataKeys = criteria.scroll(ScrollMode.FORWARD_ONLY);
            ArrayList<MetadataEntityKey> batch = new ArrayList<MetadataEntityKey>((int) configuration.batchSize());
            while (metadataKeys.next()) {
               MetadataEntityKey mKey = (MetadataEntityKey) metadataKeys.get(0);
               batch.add(mKey);
               if (batch.size() == configuration.batchSize()) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.