More JPA fixes