In my database I have a table which is show in below. Now I want to make a nested data structure to draw on a view by an algorithm to transfer data from table to this
Tables -> Seats -> Rounds -> Dish_names
Note that -> stands for 'contain'
Could anyone have a clean way to do this in Java. Thanks!

Not sure what you want exactly, but if you want a nested Java Object (entity) to correspond to the table, read on:
Since Tables contain Seats contain Rounds contain Dish_names, you start from the innermost entity (Dish):
Public class Dish{
private int id; // an id
private String dish_name;
// getters and setters
}
Your Rounds contain the Dishes
Public class Round{
private int id; // an id
private List<Dish> dishes;
// getters and setters
}
Your Seats contain the Rounds
Public class Seat{
private int id; // an id
private List<Round> rounds;
// getters and setters
}
And finally you Tables contain the Seats
Public class Table{
private int id; //
private List<Seat> seats;
// getters and setters
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With