JDBC javax.sql.RowSetListener API Question  
Author Message
Bruce Alspaugh





PostPosted: 3/23/2006 9:03:00 AM Top

java-programmer, JDBC javax.sql.RowSetListener API Question I'm implementing a TableModel for my Java Swing application that
listens for the changes in a javax.sql.RowSet object so they can be
displayed in a JTable. It seems there is a limitation in the
RowSetListener API preventing my program from obtaining the information
it needs to keep the JTable in sync with the RowSet.

I can register a RowSetListener with the RowSet object. Whenever a row
is updated, inserted or deleted, it's rowChanged(RowSetEvent event)
method is called.

The problem is that I am unable to distinguish between the three events
(insertRow, updateRow or deleteRow) or obtain the relevant row number
in my implementation of rowChanged(RowSetEvent event).

The only thing the RowSetEvent object that gets passed into rowChanged
seems to tell me is the source RowSet object of the event. I need to
be able to tell which of the three events occured and the relevant row
number so I can so I can notify the JTable by calling the appropriate
fireTableRowsInserted(), fireTableRowsUpdated(), or
fireTablesRowsDeleted() method.

How do I obtain this information from the API? If there is a better
group I should post this question to, please let me know.

Thanks,

Bruce