0

我的可嵌入类如下所示。

`@Embeddable
public class AddressBean {
    private String streetAddress;
    private String address1;
    private String address2;
    private String cityName;
    private String stateName;
    private String zipCode;
}`

和嵌入式属性是

@Embedded
    @AttributeOverrides({
        @AttributeOverride(name="streetAddress", column=@Column(name="APPLALTSTREETADDRESS")),
        @AttributeOverride(name="address1", column=@Column(name="APPLALTADDRESS1")),
        @AttributeOverride(name="address2", column=@Column(name="APPLALTADDRESS2")),
        @AttributeOverride(name="cityName", column=@Column(name="APPLALTCITYADDRESS")),
        @AttributeOverride(name="stateName", column=@Column(name="APPLALTSTATEADDRESS")),
        @AttributeOverride(name="zipCode", column=@Column(name="APPLALTSTATEZIP"))
    })
    private AddressBean altAddress;

    @Embedded
    @AttributeOverrides({
        @AttributeOverride(name="streetAddress", column=@Column(name="APPLSTREETADDRESS")),
        @AttributeOverride(name="address1", column=@Column(name="APPLADDRESS1")),
        @AttributeOverride(name="address2", column=@Column(name="APPLADDRESS2")),
        @AttributeOverride(name="cityName", column=@Column(name="APPLCITYADDRESS")),
        @AttributeOverride(name="stateName", column=@Column(name="APPLSTATEADDRESS")),
        @AttributeOverride(name="zipCode", column=@Column(name="APPLSTATEZIP"))
    })
    private AddressBean applAddress;

    @Embedded
    @AttributeOverrides({
        @AttributeOverride(name="streetAddress", column=@Column(name="APPLALTDIRECTION1ADDRESS")),
        @AttributeOverride(name="address1", column=@Column(name="APPLESIGNADDRESS1")),
        @AttributeOverride(name="address2", column=@Column(name="APPLESIGNADDRESS2")),
        @AttributeOverride(name="cityName", column=@Column(name="APPLESIGNCITYADDRESS")),
        @AttributeOverride(name="stateName", column=@Column(name="APPLESIGNSTATEADDRESS")),
        @AttributeOverride(name="zipCode", column=@Column(name="APPLESIGNSTATEZIP"))
    })
    private AddressBean esignAddress;

我想为 altAddress 和 applAddress 存储 streetAddress,但不为 esignAddress 存储。这意味着,从上面的代码中,我需要修改语句

`@AttributeOverride(name="streetAddress", column=@Column(name="APPLALTDIRECTION1ADDRESS")),`

请帮助我如何实现这一目标。提前致谢。

4

0 回答 0