Search code examples
hibernatechartswindowjfreechart

JFreeChart & Lazy loading


I'm trying to make new functionality to my app. And I faced the fact, that my app should work with big data (over 1000+ entries).Also, I'd like to mention, that data (dataset - call it how you want) is taken from DB by Hibernate. I wish i could post some code how exactly i retrieve data and add it to dataset, but it's strictly prohibited.

Any ideas how to make it

Note: Window with chart looks like this: https://classic.moqups.com/AU/SmmGSpPE/p:a16b2c2a4 when window opens - all dataset is loaded, however only one piece of window show chart. to see more, user have to click on

"<<<" or ">>>"

buttons. That will result in 'reloading data from DB' (which actually is not). it only displays what comes after the first "step" and e.t.c

I tried to explain clearer as i could.

Thanks for tips and suggestions


Solution

  • How to correctly bind to my Service?

    I'm not familiar with Hibernate, but you can query a JPA entity, as shown here, but do so in the doInBackground() implementation of a SwingWorker, as shown here. Update the chart's dataset in your implementation of process(), as shown here. The listening chart will update itself in response. You can page through the dataset using an approach such the one shown here.