Updated to use JPA rather than using JDBC