0

I am doing a project for a hospital near by. I am using Java, Hibernate and SQL server 2008. In an occasion when I am dealing with the clinical lab module I have come across a problem.

I made a JTable which contain the names of patients who ordered the test in reception. Consider the situation where there are more than 1 computer at the sample collection bay. When a technician or a lab assistant from the lab click the name of a patient (when he/she tries to attend a patient) from the JTable then the name should be removed from the JTable from all the computers in the sample collection bay(because if someone is attending a patient then the name should not be shown to others, so they can attend other patient). And also if a patient comes to reception and register himself for a test, then the name should be shown in the computer of sample collection bay(ie the JTable of all the system should be updated when the data is registered to database).

I heard about the function fireTableDataChanged() in java to use in this instance. My doubt is if a technician clicks a name, I am sure that his table will be updated through this function. But is it possible to repaint all the Jtables in all the system when a change to database is made from a system(ie is it possible to remove the name from all the other systems when a name is clicked from a system).

In another occasion I used firebird, because it itself has the functionality as I said. But here it is not possible because 80% of the project is in Microsoft SQL server. Can anyone suggest me a method. Thanks in advance.

akshaivk
  • 427
  • 5
  • 24
  • What you're basically asking for is a mechanism which, when a tech clicks a cell, sends a notification back to the server, which can then forward the notification back to other machines (like a network broadcast). Can it be done, yes, will you need to write some server based code, yes. Basically, you need a service running on the server to which all the client PCs can connect to (and register for event notification), when a PC sends an event, the server then re-sends that event to interested parties. Each party then needs to decide how to handle this request (as an example) – MadProgrammer Nov 20 '14 at 04:59
  • To update the `JTable`, you need to modify the underlying `TableModel`, and this will implementation specific, but `AbstractTableModel` provides a number of helper methods to make life easier to trigger updates that the table needs to respond to – MadProgrammer Nov 20 '14 at 05:00
  • Actually what I meant is this, When a tech click the row in a JTable, a value in column named status in db is changed. So when this change in db occurred the JTable in all the machines which are using the same application should be repainted or fired. – akshaivk Nov 20 '14 at 05:06
  • But how do all the other machines know when this is done? The DB is going to tell them... – MadProgrammer Nov 20 '14 at 05:09
  • Firebird have this functionality. I just want to know is there any possibility in sql server 2008. – akshaivk Nov 20 '14 at 05:11
  • Not my knowledge. The other issue is, you really should be communicating directly to the DB, but that's just me ;) – MadProgrammer Nov 20 '14 at 05:12
  • Well, you could check this [other question](http://stackoverflow.com/questions/877273/change-notification-with-sql-server-2008) out... – MadProgrammer Nov 20 '14 at 05:21

0 Answers0