-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: PropertyNotFoundException: Could not find a getter for...
PostPosted: Fri Jun 08, 2007 4:52 am 
Newbie

Joined: Mon Aug 14, 2006 11:47 am
Posts: 8
Hi,

Hibernate throws Exception: org.hibernate.PropertyNotFoundException: Could not find a getter for pky ... on my class. But i don't understand why, the mapping file and the source file are generated with the Hibernatetools for eclipse:


Hibernate version:
3.0

Mapping documents:
Code:
<class name="CodeValueImpl" table="DCA_CODEVALUE" schema="CODES">
        <id name="pky" type="string">
            <column name="PKY" length="100" />
            <generator class="assigned" />
        </id>


Java Source Code
Code:
public class CodeValueImpl {
   
   private String pky;

   public String getPky() {
      return this.pky;
   }

   public void setPky(String pky) {
      this.pky = pky;
   }

}



Full stack trace of any exception that occurs:

org.hibernate.PropertyNotFoundException: Could not find a getter for pky in class us.aas.codes.administrator.dto.impl.CodeValueImpl
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:118)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:425)
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:1291)


Name and version of the database you are using:
Oracle 9i


Top
 Profile  
 
 Post subject: Re: PropertyNotFoundException: Could not find a getter for..
PostPosted: Fri Jun 08, 2007 5:20 am 
Newbie

Joined: Mon Dec 11, 2006 12:54 am
Posts: 14
Hi,

Try changing your property name to following in your mapping and DAO file:

Mapping file:

<class name="CodeValueImpl" table="DCA_CODEVALUE" schema="CODES">
<id name="pKy" type="string">
<column name="PKY" length="100" />
<generator class="assigned" />
</id>



DAO :

public class CodeValueImpl {

private String pKy;

public String getPKy() {
return this.pKy;
}

public void setPKy(String pKy) {
this.pky = pky;
}

}

I think this is a common error that comes with beans where if the first letter of the property of the bean is in lower case the next letter needs to be in upper case


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.