I need help with example from book "Spring Recipes" by Josh Long. Trying to extend code example from chapter Spring @MVC with persistence layer. Author hardcoded all data. I'm searching the best-practice solution for model like this, database schema design and DAO based population of POJO data. I don't want to use Hibernate or JPA, just Spring.
Here's the model which I'm practicing with (getters and setters are omitted to reduce space):
public class Reservation {
private String courtName;
private Date date;
private int hour;
private Player player;
private SportType sportType;
}
public class Player {
private String name;
private String phone;
}
public class SportType {
private int id;
private String name;
}
I made 3 DB tables: reservation, player, sport_type. For every single table I have DAO class: ReservationDao, PlayerDao, SportTypeDao. Is that correct way?
What kind of relations in database do I need for these kind of object design?
How do I populate Reservation object in my service layer? Do I have to use one query with some joins or call ReservationDao, PlayerDao and SportTypeDao methods one by one to get single Reservation row from database?