如何从@Embeddable中排除列?

时间:2015-02-20 08:03:22

标签: java hibernate

是否可以从@Embeddable类中排除列?

像:

@Entity
public class Customer {
    @Embedded(exclude = "state") //of course this is does not exists
    private Address address;
}

@Embeddable
public class Address {
        private String street;
        private String city;
        private String state;
    private String town;
    //ect
}

1 个答案:

答案 0 :(得分:0)

您是否尝试将该字段设为Transient:http://docs.oracle.com/javaee/5/api/javax/persistence/Transient.html? 这可以解决问题,但是每个嵌入类的类都会排除该字段。

如果你只想在这个课程中忽略它,那么它是不够的:)

此致