Vadim Dissa
Vadim Dissa

Reputation: 1031

Getting EntityManager in spring boot data rest application

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

Answers (1)

Vadim Dissa
Vadim Dissa

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

Related Questions