For this mapping:
@Embeddable class PostalCode { @Column(name="country_code") String countryCode; @Column(name="zip_code") int zipCode; } @Embeddable class TownCode extends PostalCode { String town; } @Entity class Town { @AttributeOverride(name = "countryCode", column=@Column(name="town_country_code")) @AttributeOverride(name = "zipCode", column=@Column(name="town_zip_code")) @EmbeddedId TownCode townCode; }
The {{@AttributeOverride}}s simply have no effect.
Moving countryCode and zipCode down to the subclass TownCode fixes the problem.
Surely this must be very easy to fix.