Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Book.java #96

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions src/main/java/com/libraryman_api/book/Book.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

import jakarta.persistence.*;


@Entity
public class Book {
@Id

@GeneratedValue(strategy = GenerationType.SEQUENCE,
generator = "book_id_generator")
@SequenceGenerator(name = "book_id_generator",
Expand All @@ -27,23 +25,26 @@ public class Book {

@Column(name = "published_year")
private int publishedYear;
private String genre;

private String genre;

@Column(name = "copies_available", nullable = false)
private int copiesAvailable;

private String keyword;

public Book() {
}

public Book(String title, String author, String isbn, String publisher, int publishedYear, String genre, int copiesAvailable) {
public Book(String title, String author, String isbn, String publisher, int publishedYear, String genre, int copiesAvailable, String keyword) {
this.title = title;
this.author = author;
this.isbn = isbn;
this.publisher = publisher;
this.publishedYear = publishedYear;
this.genre = genre;
this.copiesAvailable = copiesAvailable;
this.keyword = keyword;
}

public int getBookId() {
Expand Down Expand Up @@ -110,9 +111,17 @@ public void setCopiesAvailable(int copiesAvailable) {
this.copiesAvailable = copiesAvailable;
}

public String getKeyword() {
return keyword;
}

public void setKeyword(String keyword) {
this.keyword = keyword;
}

@Override
public String toString() {
return "Books{" +
return "Book{" +
"bookId=" + bookId +
", title='" + title + '\'' +
", author='" + author + '\'' +
Expand All @@ -121,6 +130,7 @@ public String toString() {
", publishedYear=" + publishedYear +
", genre='" + genre + '\'' +
", copiesAvailable=" + copiesAvailable +
", keyword='" + keyword + '\'' +
'}';
}
}