MyBatis 错误:"There is no getter for property named 'item_detail'" 解决方法
"Creating a new SqlSession\nSqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@34153bc9] was not registered for synchronization because synchronization is not active\nJDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@42028b5a] will not be managed by Spring\n==> Preparing: insert into spareplan( dec_as_num, item_num, item_name, item_detail, model, capacity, storage_status, storage_num, outbound_status, outbound_num, dispatch_status, plan_status item ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) \nClosing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@34153bc9]\norg.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'item_detail' in 'class com.xm.pojo.SparePlanImport' " 这个错误是由于在com.xm.pojo.SparePlanImport类中缺少名为item_detail的属性的getter方法引起的。MyBatis无法找到该属性的getter方法,导致出现这个错误。\n\n要解决这个问题,您需要在com.xm.pojo.SparePlanImport类中添加一个名为getItem_detail()的方法,以返回item_detail属性的值。您可以根据需要实现这个方法,例如从数据库中获取数据或从其他地方获取数据。\n\n示例代码:\n\njava\npublic class SparePlanImport {\n private String item_detail;\n\n public String getItem_detail() {\n return item_detail;\n }\n\n public void setItem_detail(String item_detail) {\n this.item_detail = item_detail;\n }\n}\n\n\n确保在添加getter方法后重新编译和运行您的代码,这样就可以解决这个错误了。
原文地址: https://www.cveoy.top/t/topic/pTSe 著作权归作者所有。请勿转载和采集!