Skip to content
Open
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Bookstore.git</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
18 changes: 18 additions & 0 deletions assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>source</id>
<baseDirectory>/</baseDirectory>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<includes>
<include>readme.md</include>
<include>assembly.xml</include>
<include>pom.xml</include>
<include>src/</include>
</includes>
</fileSet>
</fileSets>
</assembly>
53 changes: 53 additions & 0 deletions java/bookstore/Author.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package bookstore;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

@Entity
public class Author {

@Id
@GeneratedValue
private Long id;

@Column(name="first_name", length=50)
protected String firstName;

@Column(name="surname", length=50)
protected String surname;

public Author(String firstName, String surname) {
this.firstName = firstName;
this.surname = surname;
}

public Author(){

}

public Long getId() {
return id;
}

public String getFirstName() {
return firstName;
}

public void setFirstName(String firstName) {
this.firstName = firstName;
}

public String getSurname() {
return surname;
}

public void setSurname(String surname) {
this.surname = surname;
}

}
83 changes: 83 additions & 0 deletions java/bookstore/Book.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package bookstore;


import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

@Entity
public class Book {

@Id
@GeneratedValue
private Long id;

@Column(name = "title", length = 50)
protected String title;

@Column(name = "genre", length = 50)
protected String genre;

@Column(name = "author", length = 50)
protected Author author;

@Column(name = "format", length = 50)
protected String format;

public Book(String title, String genre, Author author, String format) {
this.title = title;
this.genre = genre;
this.author = author;
this.format = format;
}

public Book(){

}

public Long getId() {
return id;
}

public String getTitle() {
return title;
}

public void setTitle(String title) {
this.title = title;
}

public String getGenre() {
return genre;
}

public void setGenre(String genre) {
this.genre = genre;
}

public Author getAuthor() {
return author;
}

public void setAuthor(Author author) {
this.author = author;
}

public String getFormat() {
return format;
}

public void setFormat(String format) {
this.format = format;
}






}
89 changes: 89 additions & 0 deletions java/bookstore/Customers.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package bookstore;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

@Entity
public class Customers {

@Id
@GeneratedValue
private Long id;

@Column(name="first_name",length=50)
protected String firstName;

@Column(name="surname", length=50)
protected String surname;

@Column(name="member", length=10)
protected Boolean member;

@Column(name="email", length=50)
protected String email;

@Column(name="password", length = 50)
protected String password;

public Customers() {

}

public Customers(String firstName, String surname, Boolean member, String email, String password) {
this.firstName = firstName;
this.surname = surname;
this.member = member;
this.email = email;
this.password = password;
}

public Long getId() {
return id;
}

public String getFirstName() {
return firstName;
}

public void setFirstName(String firstName) {
this.firstName = firstName;
}

public String getSurame() {
return surname;
}

public void setSurame(String surname) {
this.surname = surname;
}

public boolean getMember() {
return member;
}

public void setMember(Boolean member) {
this.member = member;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}


}
52 changes: 52 additions & 0 deletions java/bookstore/OrderLines.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package bookstore;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

@Entity
public class OrderLines {

@Id
@GeneratedValue
private Long id;

@Column(name = "book_id", length = 50)
protected Long bookId;

@Column(name = "quantity", length =50)
protected int quantity;

public OrderLines(){

}

public OrderLines(Long bookId, int quantity){
this.bookId = bookId;
this.quantity = quantity;
}

public Long getId() {
return id;
}

public Long getBookId() {
return bookId;
}

public void setBookId(Long bookId) {
this.bookId = bookId;
}

public int getQuantity() {
return quantity;
}

public void setQuantity(int quantity) {
this.quantity = quantity;
}
}
78 changes: 78 additions & 0 deletions java/bookstore/Orders.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package bookstore;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.OneToMany;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
@Entity
public class Orders {

@Id
@GeneratedValue
private Long id;

@OneToMany(cascade = CascadeType.ALL)
private Set<OrderLines> orderLines = new HashSet<>();

@Column(name = "address", length = 50)
private String address;

@Column(name = "customer_id", length = 50)
private Long customerId;

@Column(name = "store_id", length=50)
private Long storeId;

public Orders(){

}

public Orders(String address, Long customerId){
this.address = address;
this.customerId = customerId;
}

public Long getId() {
return id;
}

public String getAddress() {
return address;
}

public void setAddress(String address) {
this.address = address;
}

public Long getCustomerId() {
return customerId;
}

public void setCustomerId(Long customerId) {
this.customerId = customerId;
}

public Set<OrderLines> getOrderLines() {
return orderLines;
}

public void setOrderLines(Set<OrderLines> orderLines) {
this.orderLines = orderLines;
}

public Long getStoreId() {
return storeId;
}

public void setStoreId(Long storeId) {
this.storeId = storeId;
}

}
Loading