Hi Friends,
I found this content important for all hibernate users and found interesting to post here.
In my project I got the issue when I was trying to fetch records using from object ... query. The exception was org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of
and the reason is a small silly mistake as: it was fetching one data as 'null' and the field was declared as primitive type in POJO class of hibernate. And in the hbm the type is not given. Example,
in hbm.xml, <property name="age" column="emp_age"/>
class Employee{ int age; //here is the error with datatype }
and the reason is a premitive type can't have null value. So always set the value as abstract type i.e. the correct one is:
Integer age;
|