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

<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>html

這個錯誤的解決方案: JsonIgnoreProperties({"hibernateLazyInitializer","handler"})//添加這一行app

@Entitythis

@Table(name = "tbl_user")//能夠省略 public class User {.net

[@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;

//下面這篇博客解釋了緣由hibernate

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

相關文章
相關標籤/搜索