How do I create and instantiate a jpa repository inside a class? I\'m in a situation where I have to create repositories for different entities inside a generic class.
I finally got it working this way,
SimpleJpaRepository<User, Serializable> jpaRepository; jpaRepository = new SimpleJpaRepository<User, Serializable>( User.class, entityManager);
With SimpleJpaRepository, I can use all repository methods.
jpaRepository.save(user);