Hibernate ORM ScrollableResults - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM ScrollableResults class.

This code example shows how to use the following methods:get, next
		helper.setUseStatelessSession(useStatelessSession);
	} 
 
	@Override 
	protected T doRead() throws Exception {
		if (cursor.next()) {
			Object[] data = cursor.get();
 
			if (data.length > 1) { 
				// If there are multiple items this must be a projection 
				// and T is an array type. 
				@SuppressWarnings("unchecked") 
				T item = (T) data;
				return item;
			} 
			else { 
				// Assume if there is only one item that it is the data the user 
				// wants. 
				// If there is only one item this is going to be a nasty shock 
				// if T is an array type but there's not much else we can do... 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:close, get, next
    } 
 
    @Override 
    public void close() { 
        if (!closed) {
            scrollableResults.close();
            closed = true;
        } 
    } 
 
    @Override 
    protected void finalize() throws Throwable {
        close(); 
    } 
 
    @Override 
    public boolean hasNext() { 
        try { 
            if (nextRow != null) { 
                return true; 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getRowNumber, last
		this(selectQuery,countQuery,p.getPageNumber(),p.getPageSize());
	} 
	 
	private static int queryTatalCountByScrollableResults(Query query) {
		ScrollableResults scrollableResults = query.scroll();
		scrollableResults.last();
		return scrollableResults.getRowNumber() + 1;
	} 
 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:get, next
     */ 
    @SuppressWarnings("unchecked") 
    @Override 
    public T read() { 
     
        if (cursor.next()) {
            Object[] data = cursor.get();
     
            // Assume if there is only one item that it is the data the user 
            // wants. 
            // If there is only one item this is going to be a nasty shock 
            // if T is an array type but there's not much else we can do... 
            T item = (T) data[0];
            return item;
        } 
        return null; 
    } 
     
    /** 
     * {@inheritDoc} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:first, get
			{ 
				return arg0;
			} 
		}); 
		ScrollableResults sr = q.scroll();
		sr.first();
		Object[] row = sr.get();
		assertEquals(1, row.length); 
		Object obj = row[0]; 
		assertTrue(obj instanceof PartnerA); 
		PartnerA obj2 = (PartnerA) obj;
		assertEquals("Partner A", obj2.getName());
		s.close();
	} 
} 
 
 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:get, getBinary, getInteger, getLong, getString
            .where(builder);
    } 
 
    @Override 
    protected Attributes toAttributes(ScrollableResults results) {
        Long studyPk = results.getLong(0);
        Long seriesPk = results.getLong(1);
        int[] a = {
                results.getInteger(6),  // series.numberOfInstances
                results.getInteger(7)}; // series.numberOfInstancesA
        String retrieveAETs = results.getString(10);
        String externalRetrieveAET = results.getString(11);
        Availability availability = (Availability) results.get(12);
        byte[] seriesAttributes = results.getBinary(13);
        if (!studyPk.equals(this.studyPk)) {
            this.studyAttrs = toStudyAttributes(studyPk, results);
            this.studyPk = studyPk;
        } 
        Attributes attrs = new Attributes(studyAttrs); 
        Utils.decodeAttributes(attrs, seriesAttributes);
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:get, next
    } 
 
    @Override 
    public boolean hasNext() { 
        if (hasNext == null) {
            hasNext = results.next();
        } 
        return hasNext;
    } 
 
    @Override 
    @SuppressWarnings("unchecked") 
    public T next() { 
        if (hasNext()) { 
            hasNext = null;
            if (asArray) {
                return (T) results.get();
            } else { 
                return (T) results.get(0);
            } 

4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getRowNumber, last
            String wildcard ='%'+ URLDecoder.decode(query.trim())+'%';
            criteria.add(Restrictions.ilike("userName", wildcard));
        } 
 
        ScrollableResults scroll = criteria.scroll();
        int i = scroll.last() ? scroll.getRowNumber() + 1 : 0;
        return Long.valueOf(i);
	} 
 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:get, next
        this.results = results;
    } 
 
    public boolean hasNext() { 
        if (hasNext == null) {
            hasNext = results.next();
        } 
        return hasNext;
    } 
 
    public T next() { 
        if (!hasNext()) { 
            throw new NoSuchElementException();
        } 
 
        hasNext = null;
        return (T) results.get(0);
    } 
 
    @Override 

4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:next
    public Attributes nextMatch() { 
        checkResults(); 
        if (!hasNext)
            throw new NoSuchElementException();
        Attributes attrs = toAttributes(results);
        hasNext = results.next();
        return attrs; 
    } 
 
    private Attributes toAttributes(ScrollableResults results2) {
        byte[] spsAttributes = results.getBinary(0);
        byte[] reqProcAttributes = results.getBinary(1);
        byte[] requestAttributes = results.getBinary(2);
        byte[] visitAttributes = results.getBinary(3);
        byte[] patientAttributes = results.getBinary(4);
        Attributes attrs = new Attributes(); 
        Utils.decodeAttributes(attrs, patientAttributes);
        Utils.decodeAttributes(attrs, visitAttributes);
        Utils.decodeAttributes(attrs, requestAttributes);
        Utils.decodeAttributes(attrs, reqProcAttributes);
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Hibernate ORM ScrollableResults Methods: