Tidied up code formatting and used some Java 7 features. Added database specific interfaces and objects.