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

Using JPA created classes for each Entity in data model - Task 2 Wells Fargo #55

Open
wants to merge 2 commits into
base: flow
Choose a base branch
from
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
91 changes: 91 additions & 0 deletions src/main/java/com/wellsfargo/counselor/entity/Client.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package com.wellsfargo.counselor.entity;

import jakarta.persistence.*;

@Entity
public class Client {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long clientId;

@ManyToOne
private Advisor advisorId;

@Column(nullable = false)
private String firstName;

@Column(nullable = false)
private String lastName;

@Column(nullable = false)
private String address;

@Column(nullable = false)
private String phone;


@Column(nullable = false)
private String email;

public Client() {
}

public Client(Advisor advisorId, String firstName, String lastName, String address, String phone, String email) {
this.advisorId = advisorId;
this.firstName = firstName;
this.lastName = lastName;
this.address = address;
this.phone = phone;
this.email = email;
}

public Advisor getAdvisorId() {
return advisorId;
}

public void setAdvisorId(Advisor advisorId) {
this.advisorId = advisorId;
}

public String getFirstName() {
return firstName;
}

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

public String getLastName() {
return lastName;
}

public void setLastName(String lastName) {
this.lastName = lastName;
}

public String getAddress() {
return address;
}

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

public String getPhone() {
return phone;
}

public void setPhone(String phone) {
this.phone = phone;
}

public String getEmail() {
return email;
}

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

}
44 changes: 44 additions & 0 deletions src/main/java/com/wellsfargo/counselor/entity/Portfolio.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.wellsfargo.counselor.entity;

import jakarta.persistence.*;

import java.util.Date;

@Entity
public class Portfolio {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long portfolioId;

@ManyToOne
private Client clientId;

@Column(nullable = false)
private Date creationDate;

public Portfolio() {

}

public Portfolio(Client clientId, Date creationDate) {
this.clientId = clientId;
this.creationDate = creationDate;
}

public Client getClientId() {
return clientId;
}

public void setClientId(Client clientId) {
this.clientId = clientId;
}

public Date getCreationDate() {
return creationDate;
}

public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
}
94 changes: 94 additions & 0 deletions src/main/java/com/wellsfargo/counselor/entity/Security.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package com.wellsfargo.counselor.entity;

import jakarta.persistence.*;

import java.util.Date;

@Entity
public class Security {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long securityId;

@ManyToOne
private Portfolio portfolioId;

@Column(nullable = false)
private String name;

@Column(nullable = false)
private String category;

@Column(nullable = false)
private double purchasePrice;

@Column(nullable = false)
private Date purchaseDate;

@Column(nullable = false)
private double quantity;


public Security(Portfolio portfolioId, String name, String category, double purchasePrice, Date purchaseDate, double quantity) {
this.portfolioId = portfolioId;
this.name = name;
this.category = category;
this.purchasePrice = purchasePrice;
this.purchaseDate = purchaseDate;
this.quantity = quantity;
}

public Security() {
}


public Portfolio getPortfolioId() {
return portfolioId;
}

public void setPortfolioId(Portfolio portfolioId) {
this.portfolioId = portfolioId;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}


public String getCategory() {
return category;
}

public void setCategory(String category) {
this.category = category;
}

public Date getPurchaseDate() {
return purchaseDate;
}

public void setPurchaseDate(Date purchaseDate) {
this.purchaseDate = purchaseDate;
}

public double getPurchasePrice() {
return purchasePrice;
}

public void setPurchasePrice(double purchasePrice) {
this.purchasePrice = purchasePrice;
}

public double getQuantity() {
return quantity;
}

public void setQuantity(double quantity) {
this.quantity = quantity;
}
}