Skip to content
Snippets Groups Projects
Commit 0fd8289c authored by migudel's avatar migudel :speech_balloon:
Browse files

Solved delete a Room and its Bookings and the same to the User

parent 7af28820
No related branches found
No related tags found
1 merge request!10Add ts types and json mocks, remove poblate scripts and fix the cascade...
...@@ -40,7 +40,7 @@ public class Room { ...@@ -40,7 +40,7 @@ public class Room {
@Column(name = "available", nullable = false) @Column(name = "available", nullable = false)
private boolean available; private boolean available;
@JsonIgnore @JsonIgnore
@OneToMany(mappedBy = "roomId", fetch = FetchType.EAGER, cascade = CascadeType.MERGE) @OneToMany(mappedBy = "roomId", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private List<Booking> bookings; private List<Booking> bookings;
public Room() { public Room() {
......
...@@ -2,8 +2,6 @@ package com.uva.roomBooking.Models; ...@@ -2,8 +2,6 @@ package com.uva.roomBooking.Models;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Value;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.Basic; import jakarta.persistence.Basic;
...@@ -37,7 +35,7 @@ public class User { ...@@ -37,7 +35,7 @@ public class User {
private UserStatus status = UserStatus.NO_BOOKINGS; private UserStatus status = UserStatus.NO_BOOKINGS;
@JsonIgnore @JsonIgnore
@OneToMany(mappedBy = "userId", fetch = FetchType.EAGER, cascade = CascadeType.MERGE) @OneToMany(mappedBy = "userId", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private List<Booking> bookings; private List<Booking> bookings;
public User() { public User() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment