使用hibernate解析json时死循环问题解决
Posted ycr19921121
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用hibernate解析json时死循环问题解决相关的知识,希望对你有一定的参考价值。
package com.wangpeng.rm.domain;
import java.util.Date;
import org.apache.struts2.json.annotations.JSON;
public class MessageText
/**
* ID:编号;Message:站内信的内容;PDate:站内信发送时间;
*/
private String content;
private Date postTime;
private long messageTextId;
private Message message;
private String sourceTitle;
private String sourceUrl;
public String getSourceTitle()
return sourceTitle;
public void setSourceTitle(String sourceTitle)
this.sourceTitle = sourceTitle;
public String getSourceUrl()
return sourceUrl;
public void setSourceUrl(String sourceUrl)
this.sourceUrl = sourceUrl;
<span style="color:#ff6666;">@JSON(serialize=false) //需要加此注解</span>
public Message getMessage()
return message;
public void setMessage(Message message)
this.message = message;
public long getMessageTextId()
return messageTextId;
public void setMessageTextId(long messageTextId)
this.messageTextId = messageTextId;
public String getContent()
return content;
public void setContent(String content)
this.content = content;
public Date getPostTime()
return postTime;
public void setPostTime(Date postTime)
this.postTime = postTime;
public MessageText()
super();
// TODO Auto-generated constructor stub
需要将关联的对象进行@JSON(serialize=false)
例如:
以上是关于使用hibernate解析json时死循环问题解决的主要内容,如果未能解决你的问题,请参考以下文章