Error:
1 2 to create beanserializer (to avoid Exception, disable Serializationfeature.fail_on_empty_beans)) (through reference chain:com.agen.entity.product_$$_ jvst2a_3["Handler"]); 3 nested exception is Com.fasterxml.jackson.databind.JsonMappingException:No Serializer found for class Org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and no 4 Properties discovered to create Beanserializer (to avoid exception, disable Serializationfeature.fail_on_empty_beans)) ( Through reference chain:com.agen.entity.product_$$_jvst2a_3["handler"])
View Code
This problem occurs because:
1 @ResponseBody2@RequestMapping ("/updateproduct")3 @Transactional4 PublicProduct UpdateProduct2 (product product) {5Product Product1 =Productservice.load (Product.getproductid ());6 if(Product1! =NULL){7 Product1.setproductname (Product.getproductname ());8 Product1.setproductcre (Product.getproductcre ());9 }Ten One returnProduct1; A}
View Code
The load () used in this method gets to this piece of data in the database.
When using Load (), enter bug mode to see that although you get to this data, but you want to see, but found that the display of the object's fields are null.
But there is a value in it!!
This returns to the foreground, the foreground does not receive the value, will run out the exception:
Modify:
So we should modify the load () method to the Get () method
1 /**2 * For product modification Operation3 * @return4 */5 @ResponseBody6@RequestMapping ("/updateproduct")7 @Transactional8 PublicProduct UpdateProduct2 (product product) {9Product Product1 =Productservice.get (Product.getproductid ());Ten if(Product1! =NULL){ One Product1.setproductname (Product.getproductname ()); A Product1.setproductcre (Product.getproductcre ()); - } - the returnProduct1; -}
View Code
This will solve the problem!!
"Hibernate error" No serializer found for class Org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer "Get and load Difference"