I have a small old application designed for one user. Now software should be changed for multi users. Software is realy simple shows just a one JTable, but data are imported to this table only ones when windows is opened. And the issue is that when one user change some data different user (that works in the same time) do not see this changes because will appears when window will be opened again. And now is me question is in hibernate something like data change litener, that tell to the application tat database data has been changed and you have to update the JTable. I was thinking about @PreUpdate, but I do not know that is the good idea.
1 Answer
If you have a number of standalone applications, which all are running in separate JVM and connected to one database (I came to this conclusion because of swing tag), then it's not possible to use Hibernate listeners to deal with it.
In this case, you have to create a separate Thread, that will do database polling in background and update your view, if data changed.
2 Comments
Stanislav
Yes, it's database specific, so as I didn't know which oneDatabase you use, I didn't said about jdbc listners. As for Oracle, here is some example, how to implement it's DatabaseChangeListener interface stackoverflow.com/questions/12618915/…