Questions tagged [scrollableresults]

A result iterator that allows moving around within a Query results by arbitrary increments. sultSet.

A result iterator that allows moving around within a query results by arbitrary increments.

The Query / ScrollableResults pattern is very similar to the JDBC PreparedStatement/ ResultSet pattern and the semantics of methods of this interface are similar to the similarly named methods on ResultSet.

34 questions
59
votes
12 answers

Using Hibernate's ScrollableResults to slowly read 90 million records

I simply need to read each row in a table in my MySQL database using Hibernate and write a file based on it. But there are 90 million rows and they are pretty big. So it seemed like the following would be appropriate: ScrollableResults results =…
at.
  • 50,922
  • 104
  • 292
  • 461
22
votes
2 answers

Query results as a Stream with Hibernate 5.2

Since Hibernate 5.2, we are able to use the stream() method instead of scroll() if we want to fetch large amount of data. However, when using scroll() with ScrollableResults we are able to a hook into the retrieval process and to free memory up by…
kmandalas
  • 418
  • 1
  • 5
  • 17
8
votes
2 answers

Caused by: org.hibernate.QueryException: Could not resolve requested type for CAST : INT

Caused by: org.hibernate.QueryException: Could not resolve requested type for CAST : INT [ SELECT SUBSTRING(referenceComptable , 8, 14) AS seqNum, SUBSTRING(referenceComptable, 4,7) AS yearCegid, SUBSTRING(referenceComptable, 1,3) AS journal…
P.S
  • 113
  • 1
  • 1
  • 9
5
votes
0 answers

org.hibernate.exception.SQLGrammarException: could not execute query using scroll

I have the following query, When I tried to execute it using hibernate I get the following exception : org.hibernate.exception.SQLGrammarException: could not execute query using scroll. In my code I have scroll has FORWARD_ONLY. Can anyone…
5
votes
4 answers

Is it possible using JPA to stream results from javax.persistence.Query.getResultList()?

I'm new to JPA and I'd like to know if it is possible to stream data from a result set, I mean I do not want to wait that the query is performed to start dealing with first results, for instance in the case of a batch. Is there any possibility using…
snowflake
  • 1,750
  • 2
  • 17
  • 40
5
votes
2 answers

Eager fetching collections in Hibernate with ScrollableResults

I'm trying to use Hibernate to retrieve approximately 100 million rows from a table. I have a persisted entity Item that contains a collection of Fees inside (another persisted entity). Given that I will iterate over the result and access the fees…
4
votes
2 answers

Bulk reading of data in hibernate using scrollable result set

I was reading a blog regarding bulk fetching with hibernate http://java.dzone.com/articles/bulk-fetching-hibernate. In this, ScrollableResults is used as a solution. Here still we need to evict objects from session. I don't understand how using…
Anand
  • 20,708
  • 48
  • 131
  • 198
4
votes
1 answer

PHP PDO MySQL scrollable cursor doesn't work

For instance, I have a table with two fields: id, value. I've inserted almost 100k rows in this table. I want to use scrollable cursor. I wrote the following code: prepare($sql,…
Igor Timoshenko
  • 1,001
  • 3
  • 14
  • 27
3
votes
0 answers

ScrollableResults not initializing eager collections in Hibernate 5?

I've got an eagerly fetched one-to-many collection inside of an entity: @OneToMany(fetch = FetchType.EAGER) @Fetch(FetchMode.SUBSELECT) @JoinColumns({ @JoinColumn(name="FK_COL_1", referencedColumnName="keyValue1"), …
Depressio
  • 1,329
  • 2
  • 20
  • 39
2
votes
0 answers

ScrollableResults Pagination Issue While Combining Two Resultsets

I have to fetch values from two unrelated tables using HQL . HQL1= from AbstractTea x where x.site in (:currentSearchSite) and x.status = :status and 1=1 HQL2= from AbstractCoffee x where x.site in (:currentSearchSite) and …
Cork Kochi
  • 1,783
  • 6
  • 29
  • 45
2
votes
3 answers

How to resolve Out of memory if your procudure returns large number of records

I am currently working on a Java application. The database used is Sybase ASE 15.0. Currently I am getting the following error in one of the scenarios: java.lang.OutOfMemoryError: Java heap space I have the following procedure call in my…
azaveri7
  • 793
  • 3
  • 18
  • 48
2
votes
2 answers

Hibernate ScrollableResults Do Not Return The Whole Set of Results

Some of the queries we run have 100'000+ results and it takes forever to load them and then send them to the client. So I'm using ScrollableResults to have a paged results feature. But we're topping at roughly 50k results (never exactly the same…
malaverdiere
  • 1,527
  • 4
  • 19
  • 36
1
vote
0 answers

Hibernate ScrollableResults without transaction

I have a piece of code that iterate a ScrollableResults and do some calculation on each element. The iteration is surrounded by transaction. EntityTransaction transaction = emf.createEntityManager().getTransaction(); transaction.begin(); …
user1409534
  • 2,140
  • 4
  • 27
  • 33
1
vote
0 answers

How to get Column Names using Hibernate ScrollableResults?

I have below code, which works fine. But i need to get the column Headers. Is there any way to get ResultSet reference from ScrollableResults? I noticed that AbstractScrollableResults has ResultSet, but i cannot get handle to it. …
Ninja
  • 53
  • 9
1
vote
0 answers

Clearing maxRows/queryTimeout & ResultSet not open, operation 'next' not permitted. Verify that autocommit is OFF exceptions using ScrollableResults

I need to iterate over ScrollableResults, this is actually performed on a cron, this reads the information of a table (Informix DB) around 100000 records and saves some information on another table of another DB (Oracle 11g), but past 30 minutes it…
kinopio
  • 21
  • 7
1
2 3