Last active
March 28, 2019 04:51
-
-
Save namila007/fc118a5c85c372587aa4c856a0cc62ee to your computer and use it in GitHub Desktop.
REST Springboot 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 = "book") | |
public class Book implements Serializable | |
{ | |
@Id | |
@GeneratedValue(strategy = GenerationType.IDENTITY) | |
private int id; | |
@Column(name = "name") | |
@NotNull | |
private String name; | |
@ManyToOne( fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) | |
@JoinColumn(name = "author_id", nullable = false) | |
//@JsonBackReference("author") | |
private Author author; | |
@ManyToOne( fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) | |
@JoinColumn(name = "publisher_id", nullable = false) | |
//@JsonBackReference("publisher") | |
private Publisher publisher; | |
@NotNull | |
@Column(name = "price") | |
private double price; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment