diff --git a/src/main/java/cat/udl/eps/softarch/demo/domain/ShelterCertificate.java b/src/main/java/cat/udl/eps/softarch/demo/domain/ShelterCertificate.java index d7bdcc3..730f2d4 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/domain/ShelterCertificate.java +++ b/src/main/java/cat/udl/eps/softarch/demo/domain/ShelterCertificate.java @@ -1,7 +1,9 @@ package cat.udl.eps.softarch.demo.domain; +import com.fasterxml.jackson.annotation.JsonIdentityReference; import jakarta.persistence.Entity; import jakarta.persistence.Id; +import jakarta.persistence.OneToOne; import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; @@ -12,6 +14,10 @@ @Entity @EqualsAndHashCode(callSuper = false) public class ShelterCertificate { + @OneToOne + @NotNull + @JsonIdentityReference(alwaysAsId = true) + private Shelter shelter; @Id private Long id; diff --git a/src/main/java/cat/udl/eps/softarch/demo/repository/ShelterCertificateRepository.java b/src/main/java/cat/udl/eps/softarch/demo/repository/ShelterCertificateRepository.java new file mode 100644 index 0000000..37f578f --- /dev/null +++ b/src/main/java/cat/udl/eps/softarch/demo/repository/ShelterCertificateRepository.java @@ -0,0 +1,9 @@ +package cat.udl.eps.softarch.demo.repository; + +import cat.udl.eps.softarch.demo.domain.ShelterCertificate; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.PagingAndSortingRepository; + +public interface ShelterCertificateRepository extends CrudRepository, PagingAndSortingRepository { + +} \ No newline at end of file