diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Author.java b/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Author.java new file mode 100644 index 000000000..fa2cbc43a --- /dev/null +++ b/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Author.java @@ -0,0 +1,60 @@ +package com.iluwatar.cqrs.domain.model; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +/** + * + * @author Sabiq Ihab + * + */ +@Entity +public class Author { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id; + private String username; + private String name; + private String email; + + /** + * + * @param username + * @param name + * @param email + */ + public Author(String username, String name, String email) { + super(); + this.username = username; + this.name = name; + this.email = email; + } + + public Author() { + super(); + } + + public long getId() { + return id; + } + + public String getUsername() { + return username; + } + + public String getName() { + return name; + } + + public String getEmail() { + return email; + } + + @Override + public String toString() { + return "Author [name=" + name + ", email=" + email + "]"; + } + +} diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Book.java b/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Book.java new file mode 100644 index 000000000..37b861d36 --- /dev/null +++ b/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Book.java @@ -0,0 +1,62 @@ +package com.iluwatar.cqrs.domain.model; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.ManyToOne; + +/** + * + * @author Sabiq Ihab + * + */ +@Entity +public class Book { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id; + private String title; + private double price; + @ManyToOne + private Author author; + + /** + * + * @param title + * @param price + * @param author + */ + public Book(String title, double price, Author author) { + super(); + this.title = title; + this.price = price; + this.author = author; + } + + public Book() { + super(); + } + + public long getId() { + return id; + } + + public String getTitle() { + return title; + } + + public double getPrice() { + return price; + } + + public Author getAuthor() { + return author; + } + + @Override + public String toString() { + return "Book [title=" + title + ", price=" + price + ", author=" + author + "]"; + } + +}