Here's my Address:
Code:
@Embeddable(access = AccessType.FIELD)
public class Address implements Serializable, Comparable<Address> {
private String name;
private String line1;
private String line2;
private String city;
@ManyToOne
private State state;
private String zipCode;
/* ... */
}
and here's how I'm trying to use it as a component:
Code:
@Entity(access = AccessType.FIELD)
public class Order implements Serializable, Comparable<Order> {
@Id(generate = GeneratorType.AUTO)
private Integer id;
@Embedded
@AttributeOverrides({
@AttributeOverride(name="name", column = @Column(name="shipToName")),
@AttributeOverride(name="line1", column = @Column(name="shipToLine1")),
@AttributeOverride(name="line2", column = @Column(name="shipToLine2")),
@AttributeOverride(name="city", column = @Column(name="shipToCity")),
@AttributeOverride(name="state", column = @Column(name="shipToState_id")),
@AttributeOverride(name="zipCode", column = @Column(name="shipToZipCode")),
})
private Address shipTo;
@Embedded
@AttributeOverrides({
@AttributeOverride(name="name", column = @Column(name="billToName")),
@AttributeOverride(name="line1", column = @Column(name="billToLine1")),
@AttributeOverride(name="line2", column = @Column(name="billToLine2")),
@AttributeOverride(name="city", column = @Column(name="billToCity")),
@AttributeOverride(name="state", column = @Column(name="billToState_id")),
@AttributeOverride(name="zipCode", column = @Column(name="billToZipCode")),
})
private Address billTo;
/* ... */
}
and here's the error that I'm getting:
Code:
Repeated column in mapping for entity: Order column: state_id (should be mapped with insert="false" update="false")
It looks to me like I'm overriding the "state" column, so why is it being mapped twice? Thanks!