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.  [ 12 posts ] 
Author Message
 Post subject: Out Of Memory
PostPosted: Tue Aug 23, 2005 11:44 am 
Newbie

Joined: Tue Aug 23, 2005 11:38 am
Posts: 14
In my relational db, I have a one to many where the many is very larger, > 5000 rows.

So I can run into errors where my returned Set can cause out of memory issues.

I tried to use, as recommended in the performance section, a scrollabe results set, but then got this error: "scrollable result sets are not enabled"

I am using hibernate 3.1 with Sybase 12.5.2 with jConnect 5.0 (jconn2.jar). Upon further reading, it looks like jConnect 5.0 does not support scrollable cursors. "As of jConnect 5.0, TDS does not support scrollable cursors."

Any body have any suggestions then how to handle large results sets?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 23, 2005 11:57 am 
Senior
Senior

Joined: Wed Jul 13, 2005 4:31 pm
Posts: 142
Location: Seattle, WA
We use scroll with forward only. That doesn't require the JDBC driver to support scrollable cursor.

So, try

scroll(ScrollMode.FORWARD_ONLY)

Hope this helps


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 23, 2005 12:48 pm 
Newbie

Joined: Tue Aug 23, 2005 11:38 am
Posts: 14
That is what I tried..
ScrollableResults loanXrefs = q.scroll(ScrollMode.FORWARD_ONLY);

And I get this error:

org.hibernate.AssertionFailure: scrollable result sets are not enabled
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:368)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:334)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:88)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1162)
at org.hibernate.loader.Loader.scroll(Loader.java:1634)
at org.hibernate.loader.hql.QueryLoader.scroll(QueryLoader.java:443)
at org.hibernate.hql.ast.QueryTranslatorImpl.scroll(QueryTranslatorImpl.java:291)
at org.hibernate.impl.SessionImpl.scroll(SessionImpl.java:960)
at org.hibernate.impl.QueryImpl.scroll(QueryImpl.java:62)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 23, 2005 1:04 pm 
Senior
Senior

Joined: Wed Jul 13, 2005 4:31 pm
Posts: 142
Location: Seattle, WA
can you post your query? The particular query might not be supported for scroll.

Also, we are using 3.0.5. Perhaps you can switch jars and see if it works with that.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 23, 2005 1:17 pm 
Newbie

Joined: Tue Aug 23, 2005 11:38 am
Posts: 14
Here is the query. How do you get it to support scrolling? That is interesting....


Query q = session.createQuery("from Cats where Cat_Obj_ID = :id");
q.setInteger("id", dealPK.intValue());
ScrollableResults cats = q.scroll(ScrollMode.FORWARD_ONLY);


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 23, 2005 1:33 pm 
Senior
Senior

Joined: Wed Jul 13, 2005 4:31 pm
Posts: 142
Location: Seattle, WA
I had problems getting some queries to work when there was a Fetch-join with one-many. That is why I asked.

I just noticed something...where is the Cat_Obj_ID coming from.
I think your query should be something like...

"select c from Cats c where c.id=:id"

assuming that Cats's id property name is id.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 23, 2005 1:37 pm 
Newbie

Joined: Tue Aug 23, 2005 11:38 am
Posts: 14
The Cat_Obj_ID is the Cat's id defined in the xml.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 23, 2005 2:00 pm 
Senior
Senior

Joined: Wed Jul 13, 2005 4:31 pm
Posts: 142
Location: Seattle, WA
I'm at a loss...
I have a query...
Code:
   hql =    " select t, tr, trx.nodelevel" +
            " from Term as t, Termrelix as trx," +
            " Termrel as tr" +
            " where " ...


that is executed using..
Code:
ScrollableResults scres = session.createQuery( hql )
               .scroll(ScrollMode.FORWARD_ONLY);

It works on a few different drivers, without jdbc scroll cursors.

Only difference I can think of is the hibernate version. I am using 3.0.5. Did you try with 3.0.5?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 23, 2005 2:11 pm 
Newbie

Joined: Tue Aug 23, 2005 11:38 am
Posts: 14
Anar

Is your DB Sybase and is the JDBC verion you are using 5.0?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 23, 2005 2:22 pm 
Senior
Senior

Joined: Wed Jul 13, 2005 4:31 pm
Posts: 142
Location: Seattle, WA
no.
...but the assertion is from hibernate. I would expect it to not even request a scroll cursor for forward_only mode.

forward only is really same as hanging on to result set and returning next line by line

That makes me think there is a difference in the implementation between 3.0.5 and 3.1

Perhaps someone from hibernate team can comment.


Top
 Profile  
 
 Post subject: Re: Out Of Memory
PostPosted: Tue Aug 23, 2005 6:08 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
ravnfan wrote:
In my relational db, I have a one to many where the many is very larger, > 5000 rows.

You can try the new collection lazy="extra" feature of Hibernate 3.1

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 24, 2005 11:29 am 
Regular
Regular

Joined: Thu Dec 02, 2004 7:11 am
Posts: 85
ravnfan wrote:
That is what I tried..
ScrollableResults loanXrefs = q.scroll(ScrollMode.FORWARD_ONLY);

And I get this error:

org.hibernate.AssertionFailure: scrollable result sets are not enabled
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:368)


Set property hibernate.jdbc.use_scrollable_resultset=true


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

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.