I am using the latest Hibernate GA releases as of today. I have a very simple class that is embeddable:
Code:
@Embeddable
public class Address implements Serializable {
@Column(name = "addressStreet1", length = 40)
private String street1;
@Column(name = "addressStreet2", length = 40)
private String street2;
@Column(name = "addressApartmentNumber", length = 10)
private String apartmentNumber;
@Column(name = "addressCity", length = 40)
private String city;
@Column(name = "addressState", length = 3)
private String state;
@Column(name = "addressPostalCode", length = 11)
private String postalCode;
....
}
When I embed this class and use AttributeOverrides to rename the columns, the renaming doesn't occur. No matter what it still adds the columns with the names "addressStreet1", "addressStreet2", etc.
Here is the code for how I am embedding it:
Code:
@Embedded
@AttributeOverrides({
@AttributeOverride(name = "addressStreet1", column = @Column(name = "mailingAddressStreet1")),
@AttributeOverride(name = "addressStreet2", column = @Column(name = "mailingAddressStreet2")),
@AttributeOverride(name = "addressApartmentNumber", column = @Column(name = "mailingAddressApartmentNumber")),
@AttributeOverride(name = "addressCity", column = @Column(name = "mailingAddressCity")),
@AttributeOverride(name = "addressState", column = @Column(name = "mailingAddressState")),
@AttributeOverride(name = "addressPostalCode", column = @Column(name = "mailingAddressPostalCode"))
})
private Address mailingAddress;
What am I doing wrong?