38 lines
843 B
Java
Executable File
38 lines
843 B
Java
Executable File
package com.ankurm.hibernatedemo.association;
|
|
|
|
import jakarta.persistence.Entity;
|
|
import jakarta.persistence.FetchType;
|
|
import jakarta.persistence.GeneratedValue;
|
|
import jakarta.persistence.GenerationType;
|
|
import jakarta.persistence.Id;
|
|
import jakarta.persistence.JoinColumn;
|
|
import jakarta.persistence.ManyToOne;
|
|
import jakarta.persistence.Table;
|
|
|
|
@Entity
|
|
@Table(name = "bag_book_l")
|
|
public class BagBookL {
|
|
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
private Long id;
|
|
|
|
private String title;
|
|
|
|
@ManyToOne(fetch = FetchType.LAZY)
|
|
@JoinColumn(name = "author_id")
|
|
private BagAuthorList author;
|
|
|
|
protected BagBookL() {
|
|
}
|
|
|
|
public BagBookL(String title, BagAuthorList author) {
|
|
this.title = title;
|
|
this.author = author;
|
|
}
|
|
|
|
public Long getId() {
|
|
return id;
|
|
}
|
|
}
|