无聊想搭建一个项目,练手,做点小功能就一个卡在这个问题上
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的