diff --git a/src/main/java/com/ankurm/sdjpa4demo/domain/Money.java b/src/main/java/com/ankurm/sdjpa4demo/domain/Money.java new file mode 100644 index 0000000..bb19e7d --- /dev/null +++ b/src/main/java/com/ankurm/sdjpa4demo/domain/Money.java @@ -0,0 +1,10 @@ +package com.ankurm.sdjpa4demo.domain; + +import jakarta.persistence.Embeddable; + +import java.math.BigDecimal; + +// A value object: no identity, just its two values. Records make ideal @Embeddable +// types in Spring Data JPA 4 / Hibernate 7 - immutable, and equals()/hashCode() come free. +@Embeddable +public record Money(BigDecimal amount, String currency) {}