spring-projects / spring-projects/spring-data-rest

Wrong href with ManyToOne and FetchType.LAZY [DATAREST-1303]

Abierto
#1,663 1 comentario 0 reacciones 1 asignado Ver en GitHub

@odrotbohm ya está trabajando en esto.

Desde el 31/12/2020.

type: bug
Lenguaje dominante
Java
Estrellas
958
Forks
568
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Thomas Schuh opened DATAREST-1303 and commented

We have one entity called SignalRequest with a property signal:

@ManyToOne(fetch = FetchType.LAZY)
private Signal signal;

When we do a GET:

 

 

http://localhost:8080/api/v1/signalRequests/1/signal

the wrong href is returned (singular instead of plural):

 

 

"_links": {
        "self": {
            "href": "http://localhost:8080/api/v1/signal/2"
        },
        "signal": {
            "href": "http://localhost:8080/api/v1/signal/2"
        },
        "signalRequests": {
            "href": "http://localhost:8080/api/v1/signal/2/signalRequests",
            "templated": true
        }
}

With Spring Boot 2.0.6 href was correctly returned. The only workaround we have at the moment is to remove lazy fetch type.

 


Affects: 3.1.2 (Lovelace SR2)

9 votes, 2 watchers

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.