在owning类中:
...
@Embedded
private LatLon location;
...在引用的类中:
@Embeddable
public class LatLon implements Serializable {
private double lat;
private double lon;
...
}当我尝试使用LatLon的空值保存所属类的实例时
org.hibernate.PropertyValueException: not-null property references a null or transient value: com.*.location。
我该怎么做才能允许这个值在owning类中为空?我尝试将其设置为Nullable,但没有任何效果。
发布于 2011-03-24 00:41:18
这是因为在可嵌入的类中有double属性,所以Hibernate会为它们生成非空列。将其类型更改为Double。
https://stackoverflow.com/questions/5408574
复制相似问题