refactoring JPA samples