Hi,
I have created pojo hibtut.eg.pojo.Utente with an member attribute "sId" and created the mapping files as given below. When i run the application it gives "no getter method found for sId" error message, whereas i have written getter and setter methods(getSId() and setSId(String)).
Now if i change the variable name case to "sid" and method prototype to getSid() and setSid(String), it runs without any problem.
Is there any standard for creating Pojos?
Hibernate version: 2.0
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping> <class name="hibtut.eg.pojo.Utente" table="UTENTE"> <id name="sId" type="string" unsaved-value="null" > <column name="UTENTE_ID" sql-type="char(32)" not-null="true"/> <generator class="uuid.hex"/> </id> </class> </hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Exception in thread "main" java.lang.ExceptionInInitializerError at hibtut.eg.util.HibernateUtil.<clinit>(HibernateUtil.java:31) at hibtut.eg.main.Main.main(Main.java:25) Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for sId in class hibtut.eg.pojo.Utente at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicProper tyAccessor.java:213) at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyA ccessor.java:207) at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:14 8) at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyF actory.java:41) at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:104) at org.hibernate.persister.entity.BasicEntityPersister.<init>(BasicEntit yPersister.java:398) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(Sing leTableEntityPersister.java:104) at org.hibernate.persister.PersisterFactory.createClassPersister(Persist erFactory.java:55) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java: 199) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav a:1043) at hibtut.eg.util.HibernateUtil.<clinit>(HibernateUtil.java:27) ... 1 more
Name and version of the database you are using:
SQL Server 2000
Regards,
Kalai.
|