Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

85
Vistas
org.springframework.data.domain.Sort why the error

I use org.springframework.data.domain.Sort:

Sort sortDesc = new Sort(Sort.Direction.DESC, "id");

as in the examples. But I get an error: Error:(47, 55) java: incompatible types: java.lang.String cannot be converted to java.util.List<java.lang.String>

I tried this:

List<Sort.Order> orderList = new ArrayList<>();
orderList.add(new Sort.Order (Sort.Direction.ASC, "id"));
Sort sort = new Sort(orderList);

But I get an error:

Error:(55, 21) java: Sort(java.util.List<org.springframework.data.domain.Sort.Order>) has protected access in org.springframework.data.domain.Sort

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I suspect you are trying to Sort data from your Spring Data JPA. You cannot call Sort and instantiate it, to my knowledge. You might have been looking for something like:

List<Item> item = repository.findAll(Sort.by(Sort.Direction.DESC, "id");

As you can see in the documentation, Sort has a protected constructor and cannot be called directly in the way you are trying to instantiate it. [https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/domain/Sort.html][Spring Documentation on Sort]

I am missing too much information about the rest of your project and how you setup your data with Spring Framework to give any other information.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda