Ignore:
Timestamp:
01/06/23 15:26:00 (23 months ago)
Author:
andrejtodorovski <82031894+andrejtodorovski@…>
Branches:
main
Children:
9dcbf44
Parents:
f484b14
Message:

Added full functionality for adding review

Location:
src/main/java/com/example/autopartz/model
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/autopartz/model/Repair.java

    rf484b14 rd4b888e  
    1818    @Id
    1919    @GeneratedValue(strategy = GenerationType.IDENTITY)
    20     Integer ID_repair;
     20    @Column(name = "ID_repair")
     21    Integer id;
    2122    @OneToOne
    2223    @JoinColumn(name = "id_order")
     
    3435        this.serviceBook = serviceBook;
    3536    }
    36 
    3737    @Override
    3838    public boolean equals(Object o) {
     
    4040        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
    4141        Repair repair = (Repair) o;
    42         return ID_repair != null && Objects.equals(ID_repair, repair.ID_repair);
     42        return id != null && Objects.equals(id, repair.id);
    4343    }
    4444
  • src/main/java/com/example/autopartz/model/Review.java

    rf484b14 rd4b888e  
    77import org.hibernate.Hibernate;
    88
    9 import javax.persistence.Entity;
    10 import javax.persistence.Id;
    11 import javax.persistence.JoinColumn;
    12 import javax.persistence.ManyToOne;
     9import javax.persistence.*;
    1310import java.util.Objects;
    1411
     
    2017public class Review {
    2118    @Id
     19    @GeneratedValue(strategy = GenerationType.IDENTITY)
    2220    Integer ID_review;
    2321    Integer review_rating;
     
    2927    @JoinColumn(name = "id_user")
    3028    Client client;
     29
     30    public Review(Integer review_rating, String review_comment, Repair repair, Client client) {
     31        this.review_rating = review_rating;
     32        this.review_comment = review_comment;
     33        this.repair = repair;
     34        this.client = client;
     35    }
    3136
    3237    @Override
  • src/main/java/com/example/autopartz/model/views/RepairsForUser.java

    rf484b14 rd4b888e  
    2323@Immutable
    2424@Table(name = "`repairs_for_user`")
    25 @IdClass(OrdersForUserId.class)
    2625public class RepairsForUser implements Serializable {
    2726    @Serial
    2827    private static final long serialVersionUID = 1L;
    2928    @Id
     29    Integer repairid;
    3030    Integer userid;
    31     @Id
    3231    LocalDateTime orderdate;
    33     @Id
    34     String partname;
    3532    Integer orderid;
    3633    String rsname;
Note: See TracChangeset for help on using the changeset viewer.