Hibernate Embedded / Embeddable Invalid Exception

In the owning class:

... @Embedded private LatLon location; ... 

In the reference class:

 @Embeddable public class LatLon implements Serializable { private double lat; private double lon; ... } 

When I try to save an instance of the owner class with a null value for LatLon :

org.hibernate.PropertyValueException: not-null property references a null or transient value: com.*.location .

What can I do to make this value null in my own class? I tried to make it Nullable , and it did not affect.

+6
embedded hibernate
source share
1 answer

This is because you have double properties in your implemented class, so Hibernate generates non-null columns for them. Change their types to double .

+7
source share

All Articles