Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for personId in class com.common.entity.Person
at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:282)
at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:275)
at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:168)
at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:44)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:123)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1367)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1333)
... 23 more 我在网上找到的问题,我改了没用?
at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:282)
at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:275)
at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:168)
at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:44)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:123)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1367)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1333)
... 23 more 我在网上找到的问题,我改了没用?
解决方案 »
- 求助,JSP页面引用静态HTML图片不显示的问题
- 循环遍历div绝对定位问题
- JAVA操作ORACLE clob转换异常
- textarea显示指定html文件内容
- 本地调试成功,上传服务器后却不行,一个servlet的问题
- 求教高手啊:JSF页面URL传递参数的问题(急哪)
- 这样的需求应该怎样实现
- 请问大家什么是DAO?
- Hibernate --- Could not parse mapping document from input stream 怎么回事?
- 取消easyUI——dataGird的因为鼠标点击而自动滚动的事件
- IE选项高级中的 禁用脚本调试 每次我把对勾去掉后 打开再看 对勾还在
- apache配置tomcat问题
和明显啊 看看你实体类Person 有没有PersonId这个属性 这个属性有没有get set方法
我的Person类:
package com.common.entity;public class Person {
private Integer id;
private String personname;
private String personpassword;
private String personsex;
private String personbirthday;
private String persontelephone;
private String personemail;
private String personaddress;
private String personidentity;
public Person(){
}
public Person(String name,String password,String personidentity){
this.personname=name;
this.personpassword=password;
this.personidentity=personidentity;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPersonname() {
return personname;
}
public void setPersonname(String personname) {
this.personname = personname;
}
public String getPersonpassword() {
return personpassword;
}
public void setPersonpassword(String personpassword) {
this.personpassword = personpassword;
}
public String getPersonsex() {
return personsex;
}
public void setPersonsex(String personsex) {
this.personsex = personsex;
}
public String getPersonbirthday() {
return personbirthday;
}
public void setPersonbirthday(String personbirthday) {
this.personbirthday = personbirthday;
}
public String getPersontelephone() {
return persontelephone;
}
public void setPersontelephone(String persontelephone) {
this.persontelephone = persontelephone;
}
public String getPersonemail() {
return personemail;
}
public void setPersonemail(String personemail) {
this.personemail = personemail;
}
public String getPersonaddress() {
return personaddress;
}
public void setPersonaddress(String personaddress) {
this.personaddress = personaddress;
}
public String getPersonidentity() {
return personidentity;
}
public void setPersonidentity(String personidentity) {
this.personidentity = personidentity;
}
}
里面有get和set方法啊,我用的属性值是id,为什么出错时会说personid?
我没有用hibernate配置文件,我是有applicationContext.xml里配置的:
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="candy" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.microsoft.jdbc.sqlserver.SQLServerDriver">
</property>
<property name="url"
value="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Manager">
</property>
<property name="username" value="sa"></property>
<property name="password" value="root"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="candy" />
</property>
<property name="hibernateProperties">
<props>
<!-- <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>-->
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="javax.persistence.validation.mode">none</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>/com/common/entity/Person.hbm.xml</value>
</list>
</property>
</bean>
<!-- <bean id="personManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>-->
<bean id="personManager" class="com.common.baseDao.personManager" abstract="false"
lazy-init="default" autowire="default" dependency-check="default">
<property name="sessionFactory" >
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="LoginAction" class="com.common.action.LoginAction" scope="protoType">
<property name="personManager">
<ref bean="personManager" />
</property>
</bean>
</beans>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><!--
- 将实体映射到hibernate,
- 和实体放在同一个包
--> <hibernate-mapping package="com.common.entity">
<class name="Person.java" table="tb_person"><!-- 利用该类映射成数据库表,默认表名与类名相同,可用table指定表名 -->
<id name="id" type="java.lang.Integer">
<generator class="native"></generator> <!-- 生成主键 -->
</id>
<property name="personname"></property>
<property name="personpassword"></property>
<property name="personsex"></property>
<property name="personbirthday"></property>
<property name="persontelephone"></property>
<property name="personemail"></property>
<property name="personaddress"></property>
<property name="personidentity"></property>
</class>
</hibernate-mapping>
请问我有没有错啊?
personId缺少get方法