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

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

Aperta
#1,663 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

@odrotbohm ci sta già lavorando.

Dal 31/12/2020.

type: bug
Lingua principale
Java
Stelle
958
Fork
568
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.