多对一双向关联后使用org.codehaus.jackson.map.ObjectMapper转json时报org.codehaus.jackson.map.ObjectMapper;

严重: Exception Processing ErrorPage[exceptionType=java.lang.Throwable, location=/500.jsp]
java.lang.IllegalStateException
	at org.apache.coyote.Response.reset(Response.java:297)
	at org.apache.catalina.connector.Response.reset(Response.java:652)
	at org.apache.catalina.connector.Response.reset(Response.java:916)
	at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:417)
	at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:271)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Thread.java:619)

双向关联后转Json,由于两边都关联,会形成死循环,在实体中加注解:

@Entity
@Table(name = "T_DL_URBANDETECTUNIT")
@JsonIgnoreProperties (value = {"urbanRoadInfo"})

/*

@ManyToOne(cascade=CascadeType.ALL)
	@JoinColumn(name="URBANID")
	public UrbanRoadInfo getUrbanRoadInfo() {
		return urbanRoadInfo;
	}
	public void setUrbanRoadInfo(UrbanRoadInfo urbanRoadInfo) {
		this.urbanRoadInfo = urbanRoadInfo;
	}
*/

即可使 urbanRoadInfo不参与到json串中

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值