Skip to content

Instantly share code, notes, and snippets.

@namila007
Last active March 28, 2019 04:54
Show Gist options
  • Save namila007/7c2ed3ccc3d8df1245b6fd921fa7d570 to your computer and use it in GitHub Desktop.
Save namila007/7c2ed3ccc3d8df1245b6fd921fa7d570 to your computer and use it in GitHub Desktop.
RestSpirngboot Tutorial
@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