I'm making a car rental java desktop application using JavaFX and JDBC. I have a table containing vehicles (license plate as pkey, brand, hp, color, etc.). When the customer selects the rent option, the program lists the available cars, but shows only the brand and type. If a car is selected, it will show every info about the vehicle. I think about two options when rent menu is selected:
- Select all available cars data (not only brand and type) and store it in a list or map, so when I select a car I don't have to connect again to the DB.
- Select only the brand and type to show and if I choose a car, select all the datas from DB that the specific car has.
Which way would be better or are they even good solutions?