Files
sdjpa4-demo/src/main/java/com/ankurm/sdjpa4demo/domain/Money.java

11 lines
356 B
Java

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) {}