create data model
This commit is contained in:
parent
4e9988877a
commit
ca73621f4d
@ -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 + "]";
|
||||
}
|
||||
|
||||
}
|
62
cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Book.java
Normal file
62
cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Book.java
Normal file
@ -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 + "]";
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user