-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Having trouble joining with ScrollableResults
PostPosted: Fri Jan 03, 2014 1:56 pm 
Newbie

Joined: Thu Oct 17, 2013 8:18 pm
Posts: 13
Can't explain why this produces the correct results of [1000,2000,3000]

Code:
     Item item = (Item) HibernateUtils.getSessionFactory().getCurrentSession().createCriteria(Item.class)
        .add(Restrictions.eq("id", 12345L))
        .setFetchMode("categories", FetchMode.JOIN)
        .setReadOnly(true)
        .uniqueResult();

    for (ItemCategory category : item.getCategories()) {
      System.out.println(category.getCategoryId());
    }


But this doesnt included all of the categories and only produces [1000]

Code:
    ScrollableResults results = HibernateUtils.getSessionFactory().getCurrentSession().createCriteria(Item.class)
        .add(Restrictions.eq("id", 12345L))
        .setFetchMode("categories", FetchMode.JOIN)
        .setReadOnly(true)
        .scroll();

    results.next();

    Item item = (Item) results.get(0);

    for (ItemCategory category : item.getCategories()) {
      System.out.println(category.getCategoryId());
    }


Can someone explain what is going on here? Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.