0

I have a table having 30000 rows and when I am trying to pull one single column into a List of type String, the query is hanging for ever. If I apply check to pull only few rows it is working fine.

Below is my Method to pull the data.

public class HeFeaturesJdbcRepository {

@Autowired
JdbcTemplate jdbcTemplate;

public List<String> getAllProductIdCodes() {
    return jdbcTemplate.query("select distinct product_id_code from saa_dim_product",
            new BeanPropertyRowMapper(String.class));
}

}

It works fine if I put a logic to pull few rows.

public List getAllProductIdCodes() {
return jdbcTemplate.query("select distinct product_id_code from saa_dim_product where rownum<=10", new BeanPropertyRowMapper(String.class)); }

Also I increased my JVM memory to 3gb to check. Much appreciate your inputs.

Thanksenter code here

madhu kongara
  • 39
  • 1
  • 4
  • Is there any reason why you need to retrieve 30000 rows at once? I will recommend retrieve and process it in batches – Thum Choon Tat Sep 14 '18 at 03:02
  • I want to have this requirement as this is a reference data and want to store it inside a collection and use that for checking. – madhu kongara Sep 14 '18 at 04:06
  • 1
    Can you please elaborate on the way you use it for checking? Also, does hanging meant running for a long time or the application is not responding? – Thum Choon Tat Sep 14 '18 at 04:31
  • When I am executing from the Eclipse tool it is just hanging there and not doing anything. I am using this data to populate in a List and use it to check for the data. – madhu kongara Sep 14 '18 at 07:34
  • Does it throw any error at the end? – Thum Choon Tat Sep 14 '18 at 07:37
  • I did not wait unitl then. Wondering whether Spring application can pull say 100000 rows and store in 1 variable or not possible at all. – madhu kongara Sep 14 '18 at 09:34
  • It depends on the size of your data. [this](https://stackoverflow.com/a/36155687/6624509) might help a little – Thum Choon Tat Sep 14 '18 at 10:00
  • And for your application that seems to run forever, you can try to print something in the console for every 100 or 500 rows you process to see if it is running. I suspect that it's running, but very slowly – Thum Choon Tat Sep 14 '18 at 10:02

0 Answers0