Query string with sorting

Report a typo

Here is a model class that describes the Movie entity:

@Entity
public class Movie {
    @Id
    @GeneratedValue
    private long id;
    private String name;
    private String country;
    private String director;
    private int releaseYear;

    // constructor, getters, setters
}

We have declared a method findByCountryAndSortByYear to get a list of movies by a specific country and sorted by years:

public interface MovieRepository extends CrudRepository<Movie, Long> {
 
    @Query(value = "____", nativeQuery = true)
    List<Movie> findByCountryAndSortByYear(String country);
}

Which of the following query strings is correct for this method?

Select one option from the list
___

Create a free account to access the full topic