Commit 90e1f863 by Patryk Czarnik

model

parent 0aba61fa
package alx.model;
import java.io.Serializable;
import jakarta.persistence.*;
/**
* The persistent class for the countries database table.
*
*/
@Entity
@Table(name="countries")
@NamedQuery(name="Country.findAll", query="SELECT c FROM Country c")
public class Country extends WspolnaNadklasa implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="country_id")
private String countryId;
@Column(name="country_name")
private String countryName;
//uni-directional many-to-one association to Region
@ManyToOne
@JoinColumn(name="region_id")
private Region region;
public Country() {
}
public String getCountryId() {
return this.countryId;
}
public void setCountryId(String countryId) {
this.countryId = countryId;
}
public String getCountryName() {
return this.countryName;
}
public void setCountryName(String countryName) {
this.countryName = countryName;
}
public Region getRegion() {
return this.region;
}
public void setRegion(Region region) {
this.region = region;
}
}
\ No newline at end of file
package alx.model;
import java.io.Serializable;
import jakarta.persistence.*;
import java.util.List;
/**
* The persistent class for the departments database table.
*
*/
@Entity
@Table(name="departments")
@NamedQuery(name="Department.findAll", query="SELECT d FROM Department d")
public class Department extends WspolnaNadklasa implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="department_id", insertable=false, updatable=false)
private Integer departmentId;
@Column(name="department_name")
private String departmentName;
@Column(name="manager_id")
private Integer managerId;
//uni-directional many-to-one association to Location
@ManyToOne
@JoinColumn(name="location_id")
private Location location;
//bi-directional many-to-one association to Employee
@OneToMany(mappedBy="department")
private List<Employee> employees;
public Department() {
}
public Integer getDepartmentId() {
return this.departmentId;
}
public void setDepartmentId(Integer departmentId) {
this.departmentId = departmentId;
}
public String getDepartmentName() {
return this.departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
public Integer getManagerId() {
return this.managerId;
}
public void setManagerId(Integer managerId) {
this.managerId = managerId;
}
public Location getLocation() {
return this.location;
}
public void setLocation(Location location) {
this.location = location;
}
public List<Employee> getEmployees() {
return this.employees;
}
public void setEmployees(List<Employee> employees) {
this.employees = employees;
}
public Employee addEmployee(Employee employee) {
getEmployees().add(employee);
employee.setDepartment(this);
return employee;
}
public Employee removeEmployee(Employee employee) {
getEmployees().remove(employee);
employee.setDepartment(null);
return employee;
}
}
\ No newline at end of file
package alx.model;
import java.io.Serializable;
import jakarta.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
/**
* The persistent class for the employees database table.
*
*/
@Entity
@Table(name="employees")
@NamedQuery(name="Employee.findAll", query="SELECT e FROM Employee e")
public class Employee extends WspolnaNadklasa implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="employee_id", insertable=false, updatable=false)
private Integer employeeId;
@Column(name="commission_pct")
private Double commissionPct;
private String email;
@Column(name="first_name")
private String firstName;
@Temporal(TemporalType.DATE)
@Column(name="hire_date")
private Date hireDate;
@Column(name="last_name")
private String lastName;
@Column(name="phone_number")
private String phoneNumber;
private BigDecimal salary;
//bi-directional many-to-one association to Department
@ManyToOne
@JoinColumn(name="department_id")
private Department department;
//uni-directional many-to-one association to Employee
@ManyToOne
@JoinColumn(name="manager_id")
private Employee manager;
//bi-directional many-to-one association to Job
@ManyToOne
@JoinColumn(name="job_id")
private Job job;
public Employee() {
}
public Integer getEmployeeId() {
return this.employeeId;
}
public void setEmployeeId(Integer employeeId) {
this.employeeId = employeeId;
}
public Double getCommissionPct() {
return this.commissionPct;
}
public void setCommissionPct(Double commissionPct) {
this.commissionPct = commissionPct;
}
public String getEmail() {
return this.email;
}
public void setEmail(String email) {
this.email = email;
}
public String getFirstName() {
return this.firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public Date getHireDate() {
return this.hireDate;
}
public void setHireDate(Date hireDate) {
this.hireDate = hireDate;
}
public String getLastName() {
return this.lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getPhoneNumber() {
return this.phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public BigDecimal getSalary() {
return this.salary;
}
public void setSalary(BigDecimal salary) {
this.salary = salary;
}
public Department getDepartment() {
return this.department;
}
public void setDepartment(Department department) {
this.department = department;
}
public Employee getManager() {
return this.manager;
}
public void setManager(Employee manager) {
this.manager = manager;
}
public Job getJob() {
return this.job;
}
public void setJob(Job job) {
this.job = job;
}
}
\ No newline at end of file
package alx.model;
import java.io.Serializable;
import jakarta.persistence.*;
import java.math.BigDecimal;
import java.util.List;
/**
* The persistent class for the jobs database table.
*
*/
@Entity
@Table(name="jobs")
@NamedQuery(name="Job.findAll", query="SELECT j FROM Job j")
public class Job extends WspolnaNadklasa implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="job_id", updatable=false)
private String jobId;
@Column(name="job_title")
private String jobTitle;
@Column(name="max_salary")
private BigDecimal maxSalary;
@Column(name="min_salary")
private BigDecimal minSalary;
//bi-directional many-to-one association to Employee
@OneToMany(mappedBy="job")
private List<Employee> employees;
public Job() {
}
public String getJobId() {
return this.jobId;
}
public void setJobId(String jobId) {
this.jobId = jobId;
}
public String getJobTitle() {
return this.jobTitle;
}
public void setJobTitle(String jobTitle) {
this.jobTitle = jobTitle;
}
public BigDecimal getMaxSalary() {
return this.maxSalary;
}
public void setMaxSalary(BigDecimal maxSalary) {
this.maxSalary = maxSalary;
}
public BigDecimal getMinSalary() {
return this.minSalary;
}
public void setMinSalary(BigDecimal minSalary) {
this.minSalary = minSalary;
}
public List<Employee> getEmployees() {
return this.employees;
}
public void setEmployees(List<Employee> employees) {
this.employees = employees;
}
public Employee addEmployee(Employee employee) {
getEmployees().add(employee);
employee.setJob(this);
return employee;
}
public Employee removeEmployee(Employee employee) {
getEmployees().remove(employee);
employee.setJob(null);
return employee;
}
}
\ No newline at end of file
package alx.model;
import java.io.Serializable;
import jakarta.persistence.*;
/**
* The persistent class for the locations database table.
*
*/
@Entity
@Table(name="locations")
@NamedQuery(name="Location.findAll", query="SELECT l FROM Location l")
public class Location extends WspolnaNadklasa implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="location_id", insertable=false, updatable=false)
private Integer locationId;
private String city;
@Column(name="postal_code")
private String postalCode;
@Column(name="state_province")
private String stateProvince;
@Column(name="street_address")
private String streetAddress;
//uni-directional many-to-one association to Country
@ManyToOne
@JoinColumn(name="country_id")
private Country country;
public Location() {
}
public Integer getLocationId() {
return this.locationId;
}
public void setLocationId(Integer locationId) {
this.locationId = locationId;
}
public String getCity() {
return this.city;
}
public void setCity(String city) {
this.city = city;
}
public String getPostalCode() {
return this.postalCode;
}
public void setPostalCode(String postalCode) {
this.postalCode = postalCode;
}
public String getStateProvince() {
return this.stateProvince;
}
public void setStateProvince(String stateProvince) {
this.stateProvince = stateProvince;
}
public String getStreetAddress() {
return this.streetAddress;
}
public void setStreetAddress(String streetAddress) {
this.streetAddress = streetAddress;
}
public Country getCountry() {
return this.country;
}
public void setCountry(Country country) {
this.country = country;
}
}
\ No newline at end of file
package alx.model;
import java.io.Serializable;
import jakarta.persistence.*;
/**
* The persistent class for the regions database table.
*
*/
@Entity
@Table(name="regions")
@NamedQuery(name="Region.findAll", query="SELECT r FROM Region r")
public class Region extends WspolnaNadklasa implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="region_id", updatable=false)
private Integer regionId;
@Column(name="region_name")
private String regionName;
public Region() {
}
public Integer getRegionId() {
return this.regionId;
}
public void setRegionId(Integer regionId) {
this.regionId = regionId;
}
public String getRegionName() {
return this.regionName;
}
public void setRegionName(String regionName) {
this.regionName = regionName;
}
}
\ No newline at end of file
package alx.model;
abstract class WspolnaNadklasa {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment