fix(model): add @JsonIgnore on PersonNameAlias.person to prevent LazyInitializationException
Jackson tried to serialize the lazy Person proxy when returning alias list, causing a "no session" error. The back-reference is only needed for JPA navigation, not for API responses. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit was merged in pull request #206.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package org.raddatz.familienarchiv.model;
|
package org.raddatz.familienarchiv.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
@@ -23,6 +24,7 @@ public class PersonNameAlias {
|
|||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "person_id", nullable = false)
|
@JoinColumn(name = "person_id", nullable = false)
|
||||||
|
@JsonIgnore
|
||||||
private Person person;
|
private Person person;
|
||||||
|
|
||||||
@Column(name = "last_name", nullable = false)
|
@Column(name = "last_name", nullable = false)
|
||||||
|
|||||||
Reference in New Issue
Block a user