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 )
@Repository
public interface UserRepository extends JpaRepository<User, Long> {
@Query(value = "SELECT u FROM User u ORDER BY u.name DESC")
List<User> getSortedUsers();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.