Dette.java 1.89 KB
package fr.plil.sio.web.mvc;

import com.fasterxml.jackson.annotation.JsonManagedReference;
import java.util.Objects;
import javax.persistence.*;


@Entity
public class Dette {
    
    @Id
    @GeneratedValue(strategy= GenerationType.AUTO)
    private Long id;
    
    @Column
    private Double sommeDette;

        
    @ManyToOne(optional = false)
    @JsonManagedReference
    private User creditor;
    
    @ManyToOne(optional = false)
    @JsonManagedReference
    private User borrower;

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 97 * hash + Objects.hashCode(this.sommeDette);
        hash = 97 * hash + Objects.hashCode(this.creditor);
        hash = 97 * hash + Objects.hashCode(this.borrower);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Dette other = (Dette) obj;
        if (!Objects.equals(this.id, other.id)) {
            return false;
        }
        if (!Objects.equals(this.sommeDette, other.sommeDette)) {
            return false;
        }
        if (!Objects.equals(this.creditor, other.creditor)) {
            return false;
        }
        if (!Objects.equals(this.borrower, other.borrower)) {
            return false;
        }
        return true;
    }

    public User getCreditor() {
        return creditor;
    }

    public void setCreditor(User creditor) {
        this.creditor = creditor;
    }

    public User getBorrower() {
        return borrower;
    }

    public void setBorrower(User borrower) {
        this.borrower = borrower;
    }
    
     public Double getSommeDette() {
        return sommeDette;
    }

    public void setSommeDette(Double sommeDette) {
        this.sommeDette = sommeDette;
    }
                 




    
    
    
}