I was about to post a new topic for this, but I'm running into exactly the same problem (only I've used the NetBeans 6.9.1 wizard to generate the .hbm.xml and .java files).
The dbms is MySQL 5.1. Table 'survey' has one row, and can be queried just fine using MySQL Workbench.
1. Here's the table definition:
Table survey
============
surv_id, surv_name, surv_sqftnow, surv_typenow, surv_sqftgrowth, surv_periodgrowth, surv_entered
------------
surv_id INT
surv_name VARCHAR
surv_sqftnow INT
surv_typenow INT
surv_sqftgrowth INT
surv_periodgrowth VARCHAR
surv_entered DATETIME
2. Here's the error message:
org.hibernate.PropertyNotFoundException: Could not find a getter for survSqftnow in class survey.Survey
at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:282)
(11 lines follow)
3. Here's the Survey.hbm.xml file generated by NetBeans:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Mar 31, 2011 10:51:49 AM by Hibernate Tools 3.2.1.GA -->
<hibernate-mapping>
<class name="survey.Survey" table="survey" catalog="survey">
<id name="survId" type="int">
<column name="surv_id" />
<generator class="assigned" />
</id>
<property name="survName" type="string">
<column name="surv_name" length="50" not-null="true" />
</property>
<property name="survSqftnow" type="java.lang.Integer">
<column name="surv_sqftnow" />
</property>
<!-- other property elements removed for clarity -->
</class>
</hibernate-mapping>
4. Here's the code from the POJO:
Code:
package survey;
// Generated Mar 31, 2011 10:51:48 AM by Hibernate Tools 3.2.1.GA
import java.util.Date;
/**
* Survey generated by hbm2java
*/
public class Survey implements java.io.Serializable {
private int survId;
private String survName;
private Integer survSqftnow;
private Integer survTypenow;
private Integer survSqftgrowth;
private String survPeriodgrowth;
private Date survEntered;
public Survey() {
}
public Survey(int survId, String survName) {
this.survId = survId;
this.survName = survName;
}
public Survey(int survId, String survName, Integer survSqftnow, Integer survTypenow, Integer survSqftgrowth, String survPeriodgrowth, Date survEntered) {
this.survId = survId;
this.survName = survName;
this.survSqftnow = survSqftnow;
this.survTypenow = survTypenow;
this.survSqftgrowth = survSqftgrowth;
this.survPeriodgrowth = survPeriodgrowth;
this.survEntered = survEntered;
}
public int getSurvId() {
return this.survId;
}
public void setSurvId(int survId) {
this.survId = survId;
}
public String getSurvName() {
return this.survName;
}
public void setSurvName(String survName) {
this.survName = survName;
}
public Integer getSurvSqftnow() {
return this.survSqftnow;
}
public void setSurvSqftnow(Integer survSqftnow) {
this.survSqftnow = survSqftnow;
}
[b] public Integer getSurvTypenow() {
return this.survTypenow;
[/b] }
/* other getter and setter methods removed for clarity */
}
The only thing I can see that may be significant is, the error did not happen on the first non-PK field, which is a String type. Instead, it happened on field survSqftNow, which is mapped to java.lang.Integer.
I've seen a lot of posts, here and on other forums, about this particular exception, but many of them were resolved by correcting a typo, removing a rogue space character, etc. Here, the config file and the Java class code were both generated by a wizard.
Any thoughts would be most appreciated.