Type definition error: [simple type, class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor];

岁酱吖の 提交于 2020-04-08 11:49:20

<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Tue Jul 09 09:31:20 CST 2019</div><div>There was an unexpected error (type=Internal Server Error, status=500).</div><div>Type definition error: [simple type, class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.jpadata.entity.User$HibernateProxy$W5saRQuh[&quot;hibernateLazyInitializer&quot;])</div></body></html>

这个错误的解决方案: JsonIgnoreProperties({"hibernateLazyInitializer","handler"})//添加这一行

@Entity

@Table(name = "tbl_user")//可以省略 public class User {

[@Id](https://my.oschina.net/u/3451001)@GeneratedValue(strategy = GenerationType.IDENTITY)

private Integer id;

@Column(name = "last_name",length = 50)

private String lastName;

@Column //省略的写法

private String email;

//下面这篇博客解释了原因

http://jingpin.jikexueyuan.com/article/43050.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!