Here is the code:
Code:
@Embeddable
public class Address implements java.io.Serializable {
private String addr; // Address details
...
}
and
Code:
@Entity
@Table(name = "worker")
public class Worker {
@Embedded
private Address homeAddress;
@Embedded
@AttributeOverrides( {
@AttributeOverride(name = "addr", column = @Column(name = "workaddress")),
@AttributeOverride(name = "city", column = @Column(name = "workcity")),
@AttributeOverride(name = "country", column = @Column(name = "workcity")),
@AttributeOverride(name = "phone", column = @Column(name = "workphone")),
@AttributeOverride(name = "state", column = @Column(name = "workstate")),
@AttributeOverride(name = "zip", column = @Column(name = "workzip")) })
private Address workAddress;
...
I get an error of "Repeated column in mapping for entity" on addr for various configurations: with/without @Embedded on homeAddress, with/without @AttributeOverrides on the homeAddress. Although the error message also mentions that 'should be mapped with insert="false" update="false"', I don't think it is right for the usage.
How to solve this problem?