How to convert from database to serialization using lists

I have such applications where I used a server MySQLto store and use 5 tables of information. Whenever I had to present information, I would use jTable as follows:

# ID Name Info1 Info2 ...
=========================================
1 231 foo bar troll
2 244 .. .. .. 
3 246 .. .. ..
..
.

The identifier here is the same primary identifier that is stored in the tables. When I wanted the user to select / edit one of these records - I would apply SelectionListenerto jtable, read the identifier in the selected row and apply the changes to this object in the database (using the read identifier I)

Now I am trying to convert my application for use with serialized objects and will store the state in files. The data will be saved using LinkedList, and I will serialize the lists themselves into files (rather than individual data records).

My question is: how to use LinkedListwith jtableso that the user can still select / make changes / sort through jtable.

More specific

  • How do I know which item the user has selected in jtable- should index matching be used? Or do I need to insert the ID attribute in the base objects?
  • How to sort in LinkedListbased on the attributes of the object (for example, sort by name, info1, etc.).

Thank..

+3
source share
1

. DefaultTableModel LinkedList . setValueAt, JTable LinkedList.

0

Source: https://habr.com/ru/post/1784330/


All Articles