Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.demo;
- import javax.persistence.*;
- @Entity
- @Table(name = "books")
- public class Book {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
- private String title;
- @ManyToOne(cascade = CascadeType.ALL)
- @JoinColumn(name = "publisher_id")
- private Publisher publisher;
- @Column(name = "score")
- private int rating;
- private String description;
- public Book() {
- }
- public Publisher getPublisher() {
- return publisher;
- }
- public void setPublisher(Publisher publisher) {
- this.publisher = publisher;
- }
- public Long getId() {
- return id;
- }
- public void setId(Long id) {
- this.id = id;
- }
- public String getTitle() {
- return title;
- }
- public void setTitle(String title) {
- this.title = title;
- }
- public int getRating() {
- return rating;
- }
- public void setRating(int rating) {
- this.rating = rating;
- }
- public String getDescription() {
- return description;
- }
- public void setDescription(String description) {
- this.description = description;
- }
- }
Add Comment
Please, Sign In to add comment