Reputation: 1031
I have a simple spring data rest application and need to get EntityManager to be able to persist objects manually or do whatever is needed. I can't get how to explicitly obtain EntityManager. Thanks (link to a project on GitHub: https://github.com/VadOs1/spring-data-rest )
Upvotes: 0
Views: 610
Reputation: 1031
@Repository
public interface UserRepository extends JpaRepository<User, Long> {
@Query(value = "SELECT u FROM User u ORDER BY u.name DESC")
List<User> getSortedUsers();
}
Upvotes: 2