Dariusz on Software Quality

09/11/2009

org.hibernate.PropertyAccessException: exception setting property value with CGLIB

Filed under: en — Tags: , , , — dariusz.cieslak @

The error

org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of XYZ.setStatus().

Cause

Using primitive types (long) where NULL is possible or using wrong type (i.e. String if “char” is declared in HBM file).

Resolution

Change from primitive type (long) to wrappers (Long) or ensure correct type is defined in mapping files.

hibernate_logo_a

21/09/2009

ORA-00932: inconsistent datatypes: expected NUMBER got BINARY

Filed under: en — Tags: , , , — dariusz.cieslak @

I was getting the following error:

ORA-00932: inconsistent datatypes: expected NUMBER got BINARY

on line:

<property name="customer" column="CustomerId" />

the fix for above error was to use many-to-many tag instead of plain <property>:

<many-to-one name="customer" column="CustomerId" />

Note that class is not required here – it’s computed from return type of getCustomer() getter by reflection.

hibernate_logo_a

« Newer Posts

Powered by WordPress