Spring Boot Onetomany Relationsion
@NoArgsConstructor
@AllArgsConstructor
@Data
@Entity
public class Room {
@Id
@GeneratedValue(strategy = IDENTITY)
private Long id;
private String roomNumber;
private BigDecimal rate;
private int floorNumber;
private int guestNumber;
private Long bedCount;
@OneToMany(
mappedBy = "room",
cascade = CascadeType.ALL,
orphanRemoval = true
)
private List<RoomAmenity> roomAmenity = new ArrayList<>();
}
Code language: Java (java)
Hello Bugs