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/Employee.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 = "employee")
    1113@PrimaryKeyJoinColumn(name = "id_user")
     
    1517    private String position;
    1618
    17     @Column(name = "id_shelter", nullable = false)
    18     private Integer shelterId;
     19    @ManyToOne
     20    @JoinColumn(name = "id_shelter", nullable = false)
     21    private Shelter shelter;
    1922
    2023    @Column(name = "is_verified", nullable = false)
    21     private boolean verified;
     24    private Boolean verified;
    2225
    23     @Column(name = "verified_by_admin")
    24     private Integer verifiedByAdminId;
     26    @ManyToOne
     27    @JoinColumn(name = "verified_by_admin")
     28    private Admin adminVerificator;
    2529
    2630    public Employee(LocalDate dateCreated, String name, String email, String password, String telephone,
    27                     String position, int shelterId, boolean verified) {
     31                    String position, Shelter shelter, Boolean verified) {
    2832        super(dateCreated, name, email, password, telephone);
    2933        this.position = position;
    30         this.shelterId = shelterId;
     34        this.shelter = shelter;
    3135        this.verified = verified;
    3236    }
    3337
    34     public Employee(String position, int shelterId, boolean verified, int verifiedByAdminId) {
    35         this.position = position;
    36         this.shelterId = shelterId;
    37         this.verified = verified;
    38         this.verifiedByAdminId = verifiedByAdminId;
    39     }
    40 
    41     public Employee() {
    42 
    43     }
    44 
    4538}
Note: See TracChangeset for help on using the changeset viewer.