I have an interface that implements crudrepository. I am using @Query annotations.
I really need an entitymanager to build a native query. What should I do? Should I tear down the interface implementing crudrepository and extend from simplejparepository?
Please advise?
You don't need an entityManager - @Query annotation has a nativeQuery parameter that allows you to do just that! Check Spring Data documentation about it for more examples:
@Query(value = "SELECT * FROM USERS WHERE EMAIL_ADDRESS = ?1", nativeQuery = true)
If you still need to access the EM directly for some reason, take a look at this answer: https://stackoverflow.com/a/34876232/1563204 or at Spring Data documentation for custom JPA repositories.