Within the system I'm focusing on, we allow clients to create bookings for a number of things. Presently, I've these 2 organizations:

@Entity
public class Reservation implements Serializable {
    ...
    private long startTime;
    private long endTime;
    private int  status;
    @ManyToOne
    private Customer theCustomer;   // record who made this reservation
    @ManyToOne
    private ReservableUnit theUnit; // record what this reservation is for
    ...
}

@Entity
public class ReservableUnit implements Serializable {

    private int numOfAvailableUnits;
    ...
    private int[][][] firstMonth = new int[31][24][2];
    ...
    private int[][][] fourthMonth = new int[31][24][2];
}

//status
public static final int AVAILABLE = 0;
public static final int BLOCKED   = 1;
public static final int RESERVED  = 2;

Within the ReservableUnit table, I've 4 int[31][24][2] arrays to keep the status of 30-minute time slots as much as 3 several weeks ahead. I made use of arrays because I believe that after I bring them into memory, it might be fast to see if the asked for time slots can be found or otherwise.

A friend explained that this isn't a good idea because I must store large objects within the database. He recommended which i should remove individuals fields so when I have to see if the slots can be found, I ought to count the amount of bookings which have been designed for individuals slots by counting rows within the Reservation table. Clearly, my friend's way can help to save us some space within the database. However, over time, we'll have lots of rows within the Reservation table meaning it will require longer and longer to process the status of slots.

I'm a student without any solid practical knowledge on creating database. Hence, I'd be very grateful if a person could produce a guidance about this matter.

Sincerely,

James Tran