Java – Hibernate – PropertyNotFoundException: Could not find a getter for


I have a class that looks like the following:

public class MyClass {
    private String dPart1;

    public String getDPart1() {
        return dPart1;

    public void setDPart1(String dPart1) {
        this.dPart1 = dPart1;

My hibernate mapping file maps the property as follows:

<property name="dPart1" not-null="true"/>

I get the following error:

org.hibernate.PropertyNotFoundException: Could not find a getter for dPart1 in class com.mypackage.MyClass
        at org.hibernate.mapping.Property.getGetter(
        at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter(
        at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(
        at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(
        at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(
        at org.hibernate.tuple.entity.EntityMetamodel.<init>(
        at org.hibernate.persister.entity.AbstractEntityPersister.<init>(

It appears that hibernate doesn't like my capitalization. How should I fix this?

Best Solution

<property name="DPart1" not-null="true"/>

should work...

Related Question