Hibernate - PropertyNotFoundException:无法找到一个getter [英] Hibernate - PropertyNotFoundException: Could not find a getter for
本文介绍了Hibernate - PropertyNotFoundException:无法找到一个getter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个如下所示的类:
public class MyClass {
private String dPart1;
public String getDPart1(){
return dPart1;
}
public void setDPart1(String dPart1){
this.dPart1 = dPart1;
$ b我的hibernate映射文件如下映射属性:
$ / p>
< property name =dPart1not-null =true/>
我得到以下错误:
org.hibernate.PropertyNotFoundException:无法在类com.mypackage.MyClass中找到dPart1的getter org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:282)
at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:275)
at org.hibernate.mapping.Property.getGetter(Property.java:272)
at org.hibernate .tuple.entity.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:247)
在org.hibernate.tuple.entity.AbstractEntityTuplizer。< init>(AbstractEntityTuplizer.java:125)
at org.hibernate。 < init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping。< init>(EntityEntityModeToTuplizerMapping.java:56)
at org。 hibernate.tuple.entity.EntityMetamodel。&L t; init>(EntityMetamodel.java:302)
at org.hibernate.persister.entity.AbstractEntityPersister。< init>(AbstractEntityPersister.java:434)
at
看起来hibernate并不喜欢我的大小写。我应该如何解决这个问题?
解决方案
< property name =DPart1空= 真/>
应该可以...
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.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:282)
at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:275)
at org.hibernate.mapping.Property.getGetter(Property.java:272)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:247)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:125)
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:302)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
at
It appears that hibernate doesn't like my capitalization. How should I fix this?
解决方案 <property name="DPart1" not-null="true"/>
should work...
这篇关于Hibernate - PropertyNotFoundException:无法找到一个getter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文