The @Convert annotation assigns a JPA AttributeConverter to a persistent attribute, allowing application-specific values to be stored in a different database representation and reconstructed when loaded. section 6.3.2
Converting a monetary value
@Convert(converter = MonetaryAmountConverter.class) @Column(name = "PRICE", length = 63) private MonetaryAmount buyNowPrice; The converter stores MonetaryAmount as text such as "11.23 USD" and recreates the value from the database column. section 6.3.2
Use the annotation to:
- Map properties of entity classes or embeddable classes. section 6.3.2
- Target a nested attribute path such as "city.zipcode" within an embedded address. section 6.3.2
- Replace built-in Hibernate type adapters for selected domain properties. section 6.3.2
