Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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)
Source by bhutanio.com #
 
PREVIOUS NEXT
Tagged: #spring #boot #onetomany #relationsion
ADD COMMENT
Topic
Name
6+6 =