zoukankan      html  css  js  c++  java
  • Hibernate 报错org.hibernate.PropertyAccessException: IllegalArgumentException(已解决)

    无聊想搭建一个项目,练手,做点小功能就一个卡在这个问题上

    org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com.lssrc.pams.model.User.userId
    

     具体报错是这个,查看半天,原来是直接从别处拷贝过来的配置文件,

    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC
            "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
            "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
    
    <hibernate-mapping >
    	<class table="User" name="com.denglu.domain.User" >
            <id name="id" type="Integer">
            <column name="id"  not-null="true" />
                <generator class="native"/>
            </id>
    	    <property name="name" type="string" >
    	    	<column name="name"  />
    	    </property>
    		<property name="pwd"  type="string"  >
    			<column name="pwd"  />
    		</property>
        </class>
    </hibernate-mapping>
    

     上面的ID定义出了问题,改成

    java.lang.Integer
    

     就好了,或者改成

    int
    

     也是OK的

  • 相关阅读:
    HTML课堂笔记
    pycrul使用
    计算机网络概述
    重温冒泡排序
    初识MySQL
    宝塔Linux面板安装教程
    运维和shell
    nginx学习总结
    docker学习汇总
    linux 安装redis 完整步骤
  • 原文地址:https://www.cnblogs.com/sunxun/p/4255957.html
Copyright © 2011-2022 走看看