Fixing JPA issues