Finished migration to JPA. Database error has disappeared! Still need to test the API though.