Hibernateを使っていてよく見かけるエラーです。
PropertyNotFoundException: Could not find a getter for
出てきたエラーは以下の通りです。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for xxx in class yyy at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:310) at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:304) at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:497) at org.hibernate.tuple.PropertyFactory.buildIdentifierAttribute(PropertyFactory.java:87) at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:163) at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:520) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:148) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:163) at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:135) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:400) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857) at com.javaknowledge.util.HibernateUtil.<clinit>(HibernateUtil.java:21) ... 49 more |
同様のケースを以下で見つけました。
解決策
Stackoverflow見てみると
<property name="DPart1" not-null="true"/>
should work...
It looks as if you have a few typos. In your Customer class, rename custID to custId because your mapping expects a field named custId. Then rename the following methods...
なるほど、単に大文字小文字の打ち間違え、ミスでした。
コメント