spring - 无法处理返回/托管引用“defaultReference”
问题描述
下面的代码已经用@JsonIdentityInfo 进行了修改,但它仍然没有在响应中显示客户对象的值。
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@id",scope=FeedbackDetail.class)
@Entity @Table(name="feedback_details") @NamedQuery(name="FeedbackDetail.findAll", query="SELECT f FROM FeedbackDetail f") public class FeedbackDetail 实现 Serializable { private static final long serialVersionUID = 1L;
@Id
//@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="fb_detail_id", unique=true, nullable=false)
private int fbDetailId;
@Temporal(TemporalType.DATE)
@Column(name="fb_dur_end_date")
private Date fbDurEndDate;
@Temporal(TemporalType.DATE)
@Column(name="fb_dur_start_date")
private Date fbDurStartDate;
@Column(name="fb_received_date")
private Timestamp fbReceivedDate;
//bi-directional many-to-one association to Customer
@ManyToOne(fetch=FetchType.EAGER,cascade=CascadeType.ALL)
@JoinColumn(name="customer_id" , referencedColumnName = "cust_id")
private Customer customer;
//bi-directional many-to-one association to FinancialYear
@ManyToOne(fetch=FetchType.EAGER,cascade=CascadeType.ALL)
@JoinColumn(name="finyear_id" , referencedColumnName = "finyear_id")
private FinancialYear financialYear;
//bi-directional many-to-one association to Project
@ManyToOne(fetch=FetchType.EAGER,cascade=CascadeType.ALL)
@JoinColumn(name="project_id", referencedColumnName = "project_id")
private Project project;
//bi-directional many-to-one association to StatusMaster
@ManyToOne(fetch=FetchType.EAGER,cascade=CascadeType.ALL)
@JoinColumn(name="status_id" , referencedColumnName = "status_id")
private StatusMaster statusMaster;
//bi-directional many-to-one association to Weblink
@ManyToOne(fetch=FetchType.EAGER,cascade=CascadeType.ALL)
@JoinColumn(name="weblink_id", referencedColumnName = "weblink_id")
private Weblink weblink;
//bi-directional many-to-one association to FeedbackSurvey
@OneToMany(mappedBy="feedbackDetail")
@JsonIgnore
private List<FeedbackSurvey> feedbackSurveys;
//bi-directional many-to-one association to MailReminder
@OneToMany(mappedBy="feedbackDetail")
@JsonIgnore
private List<MailReminder> mailReminders;
public FeedbackDetail() {
}
public int getFbDetailId() {
return this.fbDetailId;
}
public void setFbDetailId(int fbDetailId) {
this.fbDetailId = fbDetailId;
}
public Date getFbDurEndDate() {
return this.fbDurEndDate;
}
public void setFbDurEndDate(Date fbDurEndDate) {
this.fbDurEndDate = fbDurEndDate;
}
public Date getFbDurStartDate() {
return this.fbDurStartDate;
}
public void setFbDurStartDate(Date fbDurStartDate) {
this.fbDurStartDate = fbDurStartDate;
}
public Timestamp getFbReceivedDate() {
return this.fbReceivedDate;
}
public void setFbReceivedDate(Timestamp fbReceivedDate) {
this.fbReceivedDate = fbReceivedDate;
}
public Customer getCustomer() {
return this.customer;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
public FinancialYear getFinancialYear() {
return this.financialYear;
}
public void setFinancialYear(FinancialYear financialYear) {
this.financialYear = financialYear;
}
public Project getProject() {
return this.project;
}
public void setProject(Project project) {
this.project = project;
}
public StatusMaster getStatusMaster() {
return this.statusMaster;
}
public void setStatusMaster(StatusMaster statusMaster) {
this.statusMaster = statusMaster;
}
public Weblink getWeblink() {
return this.weblink;
}
public void setWeblink(Weblink weblink) {
this.weblink = weblink;
}
public List<FeedbackSurvey> getFeedbackSurveys() {
return this.feedbackSurveys;
}
public void setFeedbackSurveys(List<FeedbackSurvey> feedbackSurveys) {
this.feedbackSurveys = feedbackSurveys;
}
public FeedbackSurvey addFeedbackSurvey(FeedbackSurvey feedbackSurvey) {
getFeedbackSurveys().add(feedbackSurvey);
feedbackSurvey.setFeedbackDetail(this);
return feedbackSurvey;
}
public FeedbackSurvey removeFeedbackSurvey(FeedbackSurvey feedbackSurvey) {
getFeedbackSurveys().remove(feedbackSurvey);
feedbackSurvey.setFeedbackDetail(null);
return feedbackSurvey;
}
public List<MailReminder> getMailReminders() {
return this.mailReminders;
}
public void setMailReminders(List<MailReminder> mailReminders) {
this.mailReminders = mailReminders;
}
public MailReminder addMailReminder(MailReminder mailReminder) {
getMailReminders().add(mailReminder);
mailReminder.setFeedbackDetail(this);
return mailReminder;
}
public MailReminder removeMailReminder(MailReminder mailReminder) {
getMailReminders().remove(mailReminder);
mailReminder.setFeedbackDetail(null);
return mailReminder;
}
}
解决方案
推荐阅读
- angular - 模态自动关闭 - Angular
- node.js - VS Code 远程调试集群中的 NodeJ
- javascript - 然后不等待承诺
- c++ - 我可以在不包含任何库的情况下将 int 转换为字符串吗?
? - javascript - 读取 XML 属性文本并替换文本中间的一些单词
- ruby-on-rails - 当用户和 ActiveAdmin 具有相同模型时,CanCan gem 的 Active Admin 授权
- javascript - PHP数组到javascript循环与json_encode
- python-3.x - NoneType 对象没有属性“组”
- python - 如何使用聪明的选择实现 Django Chained Drop Down
- python - 在 Python 中,可以在函数中使用循环吗?