-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: how to detect data updated by external application
PostPosted: Sun Aug 02, 2009 9:34 pm 
Newbie

Joined: Thu Nov 20, 2008 8:14 am
Posts: 6
In my Java application, i am using "saveOrUpdateListener" to detect data update in the database. It works fine as long as the change is done by own application and no longer trigger any callback when the change is done by another application, e.g. mySQL browser, running an update command.
I wonder if there is any way i can detect the data change in mySQL. Thanks.


Top
 Profile  
 
 Post subject: Re: how to detect data updated by external application
PostPosted: Mon Aug 03, 2009 1:01 am 
Regular
Regular

Joined: Tue Jan 03, 2006 9:20 am
Posts: 74
The application can't know the data changes unless it constantly polls every record in memory for such changes.
The amount of traffic to the database that generates would be potentially crippling to even the most powerful system.

Consider an application that has 20 million entities loaded (not a whole lot for a big system).
Add the relationships to be maintained, you're potentially up to 50 million rows in the database.
To ensure you always notice changes rapidly each of those would have to be polled maybe 10 times a second, for 500 million database operations per second, and 500 million object comparisons per second in the application (or else you'd need a stored procedure that performs those 500 million comparisons inside the database).
At 4KB at least per network package, that's 2TB of network traffic per second you're generating.

Not a lot of networks would be able to handle such a load.

A far better solution is to refresh a managed entity before trying to update it, and notify the user interface if there have been changes at database level from the state it had before the update request.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.