Spring Data JPA @OneToOne annotation Infinite Recursion Error

前端 未结 2 511
天命终不由人
天命终不由人 2021-01-14 10:42

Husband.java

package com.example.demo.com.example.domain;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstruc         


        
2条回答
  •  终归单人心
    2021-01-14 11:16

    You Should use @JsonBackReference with owning entity and @JsonManagedReference with child containing entity classes.

    @JsonManagedReference
    @Onetoone
    private Queue queues;
    
    
    
        @Onetoone
        @JoinColumn(name = "qid")
       // @JsonIgnore
        @JsonBackReference
        private Queue_group queue_group;
    

提交回复
热议问题