Refactored to use the criteria API instead of native SQL (cleaner and easier to test) and implemented integration tests with an in-memory database.