/
pavelsamodurov
/
financejavaee216
Обзор
Документация
Войти
/
pavelsamodurov
/
financejavaee216
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
financejavaee-ejb/src/main/java/com/testproject/model/Customer.java
120 строк
3 KB
Pavel Samodurov
add customer page with table and with form for adding new customer
26 фев 2020, 21:27
26 фев 2020, 21:27
b7c415d
Код
Авторство
О чём код?
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.testproject.model; import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlRootElement; /** * * @author Pavel Samodurov ps07t447@gmail.com */ @Entity @Table(name = "customer") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Customer.findAll", query = "SELECT c FROM Customer c"), @NamedQuery(name = "Customer.findById", query = "SELECT c FROM Customer c WHERE c.id = :id"), @NamedQuery(name = "Customer.findByName", query = "SELECT c FROM Customer c WHERE c.name = :name"), @NamedQuery(name = "Customer.findByAddress", query = "SELECT c FROM Customer c WHERE c.address = :address")}) public class Customer implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "id") private Integer id; @Basic(optional = false) @NotNull @Size(min = 1, max = 2147483647) @Column(name = "name") private String name; @Basic(optional = false) @NotNull @Size(min = 1, max = 2147483647) @Column(name = "address") private String address; public Customer() { } public Customer(Integer id) { this.id = id; } public Customer(String name, String address) { this.name = name; this.address = address; } public Customer(Integer id, String name, String address) { this.id = id; this.name = name; this.address = address; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Customer)) { return false; } Customer other = (Customer) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "Customer{" + "id=" + id + ", name=" + name + ", address=" + address + '}'; } }