0

Background loading data from DB

asked 2014-06-20 09:25:56 +0800

sentinal gravatar image sentinal
11 2

updated 2014-06-21 07:16:43 +0800

I want to load some big data from DB. I use MVVM. So how i can load data in background and then notify user that data is loading. Can i use other thread? And i need that UI doesn't stop working during loading.

delete flag offensive retag edit

Comments

I load objects from DB using Hibernate. I need to calculatre then some statistic and show this object using grid. But first i need to load all object from db in memory. I need that whyle people in main page see some general information, this data load in background.

sentinal ( 2014-06-21 07:16:52 +0800 )edit

4 Answers

Sort by ยป oldest newest most voted
0

answered 2014-06-22 19:46:53 +0800

chillworld gravatar image chillworld flag of Belgium
5367 4 9
https://github.com/chillw...

Sentinel,

You have several options.
You could use caching for the data.
This means of course more memory usage.

Option 2, is like caching but manual :
Define a "cron job" that is triggered each x time.
Put the data in the application scope.
When you need it, get it from the application scope.

Otherwise you have trigger an asynchoneous task in the background.
This topic of Dzone can guide you with it.

You have to see what option is best for you. (lot of usage of the big data I would go for caching, less needs => async task).
Of course it also depends on when you need your data. Is it when you are on one specific page, or must it always be available.

Greetz chill.

link publish delete flag offensive edit
0

answered 2014-06-21 01:50:00 +0800

mhj gravatar image mhj flag of Brazil
806 1 7

Hello sentinal, you don't specify what type of data you want to load and where you want to show if really you want to show. for example if you want to show data in a grid i think is not good to load many data once, you can use paging for example. Now if you want to load for save on file is a different type of approach...

link publish delete flag offensive edit
0

answered 2014-06-21 22:43:41 +0800

mhj gravatar image mhj flag of Brazil
806 1 7

i think you could use something like this: upload_effect

link publish delete flag offensive edit
0

answered 2014-07-01 07:55:40 +0800

Buras12 gravatar image Buras12
1
http://www.bankowerady.pl...

Im recomending upload_effect

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-06-20 09:25:56 +0800

Seen: 35 times

Last updated: Jul 01 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More