Sunday, February 20, 2011

Springing DAO: Spring + Hibernate (Part 1)

So now that I have a rough idea I could get this puppy to code. We are winging it after all. Then again, software development is really like this. Hey, I have made projects with even less.But lets got get ahead of ourselves. Before we write anything, we have to deal with the database design.

Now about the database, I am using the MySQL that comes with XAMPP. Its free for the download and it already comes with phpmyadmin. I know I can do this "old school" and go command line but who needs that aggravation. Masochism isn't really my thing.

Using phpmyadmin, here is the schema.
Figure 1 Our project database schema


*Now if you say this can't be done just by using phpmyadmin alone then apparently you are using it wrong.

The design is quite straight-forward. There are four primary tables:
  1. User Table - contains the log-in and password recovery data. Its support tables of role and user_detail is quite easy to figure out.
  2. Request Table - handles all the request generated by the users. It should be noted that creating a request doesn't mean you automatically have an "approved" avr reservation.
  3. AVR table - contains the available AV rooms that can be reserved. The "isAvailable" flag is used if the AVR can be reserved and is not under repair or something.
  4. Status table - it tracks the state of the request. If you can recall in my previous post, the flow chart logic is on this table. On a side note, the "set_by" field should be linked to the user table via a foreign key.You should be able to figure that one out.
Stay tune for part 2 when we actually starting writing code.