Last active
March 28, 2019 04:54
-
-
Save namila007/7c2ed3ccc3d8df1245b6fd921fa7d570 to your computer and use it in GitHub Desktop.
RestSpirngboot Tutorial
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Data | |
@AllArgsConstructor | |
@NoArgsConstructor | |
@Entity | |
@Table(name = "publisher") | |
public class Publisher implements Serializable | |
{ | |
@Id | |
@GeneratedValue(strategy = GenerationType.IDENTITY) | |
private int id; | |
@Column(name = "name") | |
@NotNull | |
private String name; | |
@Column(name = "address") | |
@NotNull | |
private String address; | |
@OneToMany(mappedBy = "publisher", cascade = CascadeType.ALL) | |
//@JsonManagedReference("publisher") | |
@JsonIgnore | |
private List<Book> bookList= new ArrayList<>(); | |
public void addBook(Book book) { | |
this.bookList.add(book); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment