Hi I use spring jpa to access my data in my spring boot project.I am wondering that is there any difference between @Query annatotation and critearia api in jpa.Are they totaly same or is there any difference(Their writing styles are different ,and I mean any performance or other issue between them) Mostly I prefer @Query annotation it looks simple.Or any other option some one can advice like @Query or criteria api in spring jpa.And is there any disadvantages of @Query style?
@Query("SELECT u FROM User u WHERE u.status = 1")
Collection<User> findAllActiveUsers();
List<Book> findBooksByAuthorNameAndTitle(String authorName, String title) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Book> cq = cb.createQuery(Book.class);