Matthew Brown wrote:I'm not sure what your question is (what have you tried so far?), but I can see a couple of problems with that design.
Firstly, having a list where the first element is the ID, the second is the name, etc, isn't a good idea. A much better idea is to create a class with fields containing the values you want, and then have a map of ID to object.
Secondly, that doesn't seem to match your data design. The way you've described it suggests that for a given model ID there's going to be a single car ID and car name. Is that correct? If so your tables are badly designed. The table design (assuming carID is a primary key of the Car table, and modelID is a primary key of the Model table, which would make sense) suggests that you can have more than one Car for each Model. Which is the right interpretation?
Maybe you can describe what the data is supposed to represent and we can advise you further.
Well i tried to simplify the problem but i think i made it worst, let me give you the full thing:
Your program must do:
1 - Read a carinfo txt file with the format
Data: MMddyyyy
ModelID: mmmmmm (Always 6 numbers)
CityID: ccccc (Always 5 numers)
carID: xxxxxxxxx (no fixed size)
eg.
mmDDyyyymmmmmmcccccxxxxxxxxxxxxxxxx
e.g
1005201200012210020565765765453543543
2 – Read a model CSV file
modelID
modelName
modelYear
brand
eg:
234211;A1;2013;AUDI
3 – Read a city file in CSV format
CityID
cityName
state
country
eg:
10220;NYC;NY;USA
4 – Store all info into a database.
5 – Create a window with 4 buttons:
a) By Date
b) By Model
c) By City
d) Details
each window shows the carinfo data grouped by whats on the button, each window must have a table that show all possible information
e.g.
ModelID: mmmmm
ModelName: A1
Model Year: 2013
Brand: Audi
Date: 01/01/1970
carID:xxxxxxxxxx
ModelID: mmmmm
ModelName: Lexus
Model Year: 2001
Brand: GM
Date 01/01/1999
carID:xxxxxxxxxx
So i did 3 tables, one for each file, and now i need to retrieve the data and show like that, so i thought i could use a HashMap to put all values related to a modelID in the Map and then display into a JTable