Sergey,
The link is quite informative, and i tried using YesNo in my mapping file
Following is a property from my mapping file
Quote:
<property name="maleOrFemale" type="YesNo">
<column name="IS_MALE" />
</property>
Following are getter / setter of the maleOrFemale attribute in the domain class
Code:
private boolean maleOrFemale;
public boolean isMaleOrFemale() {
return maleOrFemale;
}
public void setMaleOrFemale(boolean maleOrFemale) {
this.maleOrFemale = maleOrFemale;
}
Following is the code I wrote to execute list() of the query object to retrieve a list
Code:
Session objSession = MyHibernateUtil.currentSession();
strQuery = " from Person ";
objQuery = objSession.createQuery(strQuery);
listPeople = objQuery.list();
Exception is as follows :
Code:
Initial SessionFactory creation failed.org.hibernate.MappingException: Could not determine type for: YesNo, for columns: [org.hibernate.mapping.Column(IS_MALE)]
java.lang.ExceptionInInitializerError
at src.MyHibernateUtil.<clinit>(MyHibernateUtil.java:16)
at src.ManageOrders.listFamilies(ManageOrders.java:193)
at src.TestHibernate.main(TestHibernate.java:154)
Caused by: org.hibernate.MappingException: Could not determine type for: YesNo, for columns: [org.hibernate.mapping.Column(IS_MALE)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:265)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:252)
at org.hibernate.mapping.Property.isValid(Property.java:174)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:325)
at org.hibernate.mapping.RootClass.validate(RootClass.java:188)
at org.hibernate.cfg.Configuration.validate(Configuration.java:839)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1000)
at src.MyHibernateUtil.<clinit>(MyHibernateUtil.java:12)
... 2 more
Exception in thread "main"
Thanks
Ahmad