2020-03-31

Hibernate JPA @AttributeOverrides Example

The @AttributeOverrides is used to group several @AttributeOverride annotations.

@AttributeOverrides used to override mappings of multiple properties or fields.


Example:

    @Embedded
    @AttributeOverrides({
            @AttributeOverride(name="startDate", 
                               column=@Column("EMP_START")),
            @AttributeOverride(name="endDate", 
                               column=@Column("EMP_END"))
    })
    public EmploymentPeriod getEmploymentPeriod() { ... }

No comments:

Post a Comment