Hibernate映射文件问题nested exception is org.hibernate.PropertyAccessException:
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Hibernate映射文件问题nested exception is org.hibernate.PropertyAccessException:相关的知识,希望对你有一定的参考价值。
如果有三张表
type [typeNO,typeName],
mytype [typeNO,typeName],
component[componentNO,componentName,type,mytype,standard],
type mytype 的typeNO都是表 component的外键,分别对应的字段是type,mytype
建立Hibernate的映射文件,键生成规则都是native,但是如果想查询type或者是mytype为一个特定值时的数据,那么就抛出
object is not an instance of declaring class
IllegalArgumentException occurred calling getter of com.last.pojo.Mytype.typeNo
IllegalArgumentException occurred calling getter of com.last.pojo.Mytype.typeNo; nested exception is org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com.last.pojo.Mytype.typeNo
,请问这是设置了一对多或者set、多对一的影响么?
我映射文件和java基本类都是采用Myeclipse 的ReverseEngineering生成的,所以字段对上的
16. nested exception is com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecogniz
org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver:handleHttpMessageNotReadable:384 -Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Unrecognized field "auditUnitName" (class com.ylkj.business.auditresult.problem.pojo.dto.ProblemSaveDto), not marked as ignorable (40 known properties: "problemNo", "rectifyperiodEnd", "amountOfPreviousYear", "projectName", "isCarryOver", "institutionProblem", "rectifyperiodStart", "isReportDisclosure", "area", "itemId", "problemNoGw", "requestCompleteTime", "problemAmount", "oneLevelType", "rectifyState", "responsibleUnit", "auditedUnit", "threeLevelType", "checkType", "auditOpinion", "responsiblePerson", "policyBasis", "twoLevelType", "itemTreeLevel", "importance", "currentYearInvolvedAmount", "definitionOfResponsibility", "problemType", "matterId", "year", "isIncludeFormalOpinions", "violationReason", "professionClassify", "isDistribute", "violationNature", "questionDate", "manageReason", "manageUnit", "isRemainProblem", "remainYear"]) at [Source: java.io.PushbackInputStream@7c1c7412; line: 1, column: 936] (through reference chain: com.ylkj.business.auditresult.problem.pojo.dto.ProblemSaveDto["auditUnitName"]); nested exception is com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "auditUnitName" (class com.ylkj.business.auditresult.problem.pojo.dto.ProblemSaveDto), not marked as ignorable (40 known properties: "problemNo", "rectifyperiodEnd", "amountOfPreviousYear", "projectName", "isCarryOver", "institutionProblem", "rectifyperiodStart", "isReportDisclosure", "area", "itemId", "problemNoGw", "requestCompleteTime", "problemAmount", "oneLevelType", "rectifyState", "responsibleUnit", "auditedUnit", "threeLevelType", "checkType", "auditOpinion", "responsiblePerson", "policyBasis", "twoLevelType", "itemTreeLevel", "importance", "currentYearInvolvedAmount", "definitionOfResponsibility", "problemType", "matterId", "year", "isIncludeFormalOpinions", "violationReason", "professionClassify", "isDistribute", "violationNature", "questionDate", "manageReason", "manageUnit", "isRemainProblem", "remainYear"]) at [Source: java.io.PushbackInputStream@7c1c7412; line: 1, column: 936] (through reference chain: com.ylkj.business.auditresult.problem.pojo.dto.ProblemSaveDto["auditUnitName"])
解决方案如下:
在需要转化的对象的类中添加注解,注解信息如下:
@JsonIgnoreProperties(ignoreUnknown = true)
以上是关于Hibernate映射文件问题nested exception is org.hibernate.PropertyAccessException:的主要内容,如果未能解决你的问题,请参考以下文章
Hibernate 和 Oracle VARRAYS/嵌套表
16. nested exception is com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecogniz
在使用hibernate 和spring 构架的框架中如果出现Initialization of bean failed; nested exception is java.lang.NoSuchMe
ssh启动报错:org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection time