Hello ranchers ! I'm doing a simple Swing-based GUI application that can view, modify, add, delete records that are stored in a DB table. This application could be used by multiple users, and i have a problem with this: How do i actually have the records updates or additions or deletions by one client be known by other clients that also use that application. I'll describe a little about the GUI. It has a simple JDialog that has JTextFields, JCheckBoxes, etc that represent a Table record. The JButtons for going to the next record, going to the previous record, saving changes(update), adding, deleting record, etc are placed there too. I use the SQL statement 'select * from TableName;' and keep all the records in a LinkedList, so i can do the prev and next easily as i dont need to have the DB server execute an SQL statement just for the next or previous record. Every updates made renders updates in my DB Table and my LinkedList representing my Table records. All things went quite well until i realized that my current application only work with a single user in a single computer. If my application is to be used by many users, every user will maintain their own linked list that doesnt know what other users have done to the Table records. Is it possible to have other users, that also use the same application, know what changes i've made to the records in a Table ? Please, any idea would help. Thanks.
Do you think i should have all the clients connect to the DB through a kind of middleware, which is a remote object ? And all the prev, next, add, delete, update operations are done through the method calls of the remote object ?
Yes, this way you can control the clients access to the database - and you can even make some RMI callbacks to the clients if you e.g. want to give messages to the clients. The important think here is that there is some kind of central unit that the clients have to pass. /Rene [ July 18, 2002: Message edited by: Rene Larsen ]
jhun kam
Greenhorn
Joined: Dec 05, 2001
Posts: 18
posted
0
Thanks for the idea. I am currently trying the RMI, all the stuffs with creating an interface, remote object implementation, the server residing in registry, the stub n skeletion via rmic, and the client. Things are going quite well. But how am i supposed to do callbacks to the clients ? How can i reference them ? Could a client send their reference(this keyword) through a remote method call, and be called from the remote object ?