3
我有類AttributeOverride來設置空值映射的領域
@Embeddable
public class MyClass implements Serializable
{
private String field1;
private String field2;
private String field3;
// getters, setters
}
,我已經映射類
public class MappedClass implements Serializable
{
@Embedded
@AttributeOverrides(
{
@AttributeOverride(name = "field1", column = @Column(name = "column1")),
@AttributeOverride(name = "field2", column = @Column(name = "column2")),
@AttributeOverride(name = "field3", column = @Column(name = "column3"))
})
private MyClass myClassField1;
@Embedded
@AttributeOverrides(
{
@AttributeOverride(name = "field1", column = @Column(name = "column1")),
@AttributeOverride(name = "field2", column = @Column(name = "column2")),
})
private MyClass myClassField2;
// setters, getters
}
我想,在myClassField2「filed3」是「空」,becouse「字段3」不是招數據庫映射。 我能做什麼? 'field3'欄中的'field3'的JPA搜索值
在Hibernate中,所有通過正常!
<component name="myClassField1" class="MappedClass">
<property name="field1" type="string" column="column1" />
<property name="field2" type="string" column="column2" />
<property name="field3" type="string" column="column3" />
<component/>
<component name="myClassField2" class="MappedClass">
<property name="field1" type="string" column="column1" />
<property name="field2" type="string" column="column2" />
<component/>
但我需要這在JPA