Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6869963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:37:26+00:00 2026-05-27T03:37:26+00:00

Have an application that has a Jtable with the data held in RAM, the

  • 0

Have an application that has a Jtable with the data held in RAM, the table can upto be 1,000,000 rows by 100 columns so this just uses too much memory. So now I’m moving to backing the JTable from a database, but I think getting directly from JTable to database is not going to help much because either all the data from the database is going to get loaded into memory when jtable initilized , or as the user scrolls down the tabel I would do select staements to get the next data, which would be too slow, and how would I handle sorting.

So I think the correct solution is to stick Hibernate between the JTable and Database, but I still can’t quite see how this is going to help with a really large JTable.

Can anyone point me to a good example / have experience of using this with large dataset to keep memory usage down.

EDIT:Ive read some comments on other threads that a table with this much data should have filters so that only a subset of data is ever shown. I agree with that as a general principle and I will provide a filter HOWEVER only the user can decide how they want to filter it, and I still need to provide a ‘ALL’ option, and this is where it could all blow up.

I also remember something about having one table on top of another showing some kind of subset of the data that changes as you scroll down, but not seen a concrete example of this idea.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:37:27+00:00Added an answer on May 27, 2026 at 3:37 am

    Normally for a function that displays large amount of records in the table format ,in order to consume less memory, the records will be shown page by page just like the Stackoverflow reputation league

    Hibernate ‘s Criteria and Query API provides the following functions to do the pagination:

    • setMaxResults(int maxResults) to limit the number of the row to be retrieved
    • setFirstResult(int firstResult) to set the first row number to be retrieved (ie. 0 means first row)

    In the JTable , you should has the variables for storing the number of records shown per page (pageNum) and the current page number (pageNum). Whenever user changes the pageNum by navigating the page forward or backward , you fetch the records for this page:

    Query q = entityManager.createQuery("from someTable tbl order by tbl.id asc");
    q.setFirstResult((pageNum -1)*pagesize).setMaxResults(pagesize); 
    

    Important Points:

    • Without the "order by" clause , the order of the fetched row is unpredictable . So , it is important that the query has to be sorted by the "order by clause" such that the displaying order of the records can be maintained when the page is browsed forward and backward .

    You can refer to this (Use Google translate to translate to English) and its Github for an example about JTable pagination using Hibernate or JDBC.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have application that has to check multiple data from user table, in order
I have an application that has 3 level of data depth: list of presentations
We have an application that has to be flexible in how it displays it's
I have an application that has created a number of custom event log sources
I have an application that has Powershell 1 embedded into it, but we need
I have an application that has many different types of objects that each persist
We have an application that has one or more text console windows that all
I have an application that has several objects (about 50 so far, but growing).
I have an application that has multiple states, with each state responding to input
I have an application that has to deal with getting special characters in its

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.