Hibernate一对一相互调用造成StackOverflowError

傻逼了我(记一次),在使用 hibernate映射1-1。解决 toString删除其中的一个引用的类

java.lang.StackOverflowError
	at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:648)
	at java.lang.StringBuilder.append(StringBuilder.java:208)
	at java.sql.Timestamp.toString(Timestamp.java:302)
	at java.lang.String.valueOf(String.java:2994)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at com.zhiyou100.one2one.IdCard.toString(IdCard.java:16)
	at java.lang.String.valueOf(String.java:2994)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at com.zhiyou100.one2one.Person.toString(Person.java:14)
	at java.lang.String.valueOf(String.java:2994)
	at java.lang.StringBuilder.append(StringBuilder.java:131)

https://blog.csdn.net/weixin_46138936/article/details/108376261

posted @ 2021-12-08 20:03  MikiKawai  阅读(61)  评论(0编辑  收藏  举报