Ignore:
Timestamp:
03/09/23 16:11:48 (16 months ago)
Author:
GitHub <noreply@…>
Branches:
main
Children:
0078d84, 4ab3aae
Parents:
8b7dd7f (diff), 264d675 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
SazdovaEkaterina <74919977+SazdovaEkaterina@…> (03/09/23 16:11:48)
git-committer:
GitHub <noreply@…> (03/09/23 16:11:48)
Message:

Merge pull request #9 from SazdovaEkaterina/fix-foreign-keys

Fix Database Mapping in Models

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Prototype Application/Paw5/src/main/java/finki/paw5/model/entities/Adoption.java

    r8b7dd7f rc3278ac  
    33import jakarta.persistence.*;
    44import lombok.Data;
     5import lombok.RequiredArgsConstructor;
    56
    67import java.time.LocalDate;
     
    89@Data
    910@Entity
     11@RequiredArgsConstructor
    1012@Table(name = "adoption")
    1113public class Adoption {
     
    2325
    2426    @Column(name = "approved", nullable = false)
    25     private boolean approved;
     27    private Boolean approved;
    2628
    27     @Column(name = "id_adopter", nullable = false)
    28     private Integer adopterId;
     29    @ManyToOne
     30    @JoinColumn(name = "id_adopter", nullable = false)
     31    private Adopter adopter;
    2932
    30     public Adoption(LocalDate startDate, LocalDate endDateFoster, boolean approved, Integer adopterId) {
     33    public Adoption(LocalDate startDate, LocalDate endDateFoster, Boolean approved,
     34                    Adopter adopter) {
    3135        this.startDate = startDate;
    3236        this.endDateFoster = endDateFoster;
    3337        this.approved = approved;
    34         this.adopterId = adopterId;
    35     }
    36 
    37     public Adoption() {
     38        this.adopter = adopter;
    3839    }
    3940}
Note: See TracChangeset for help on using the changeset viewer.