Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package javaapplication3;
- import java.io.Serializable;
- import java.util.Collection;
- import javax.persistence.Basic;
- import javax.persistence.CascadeType;
- 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.OneToMany;
- import javax.persistence.Table;
- /**
- *
- * @author celalo
- */
- @Entity
- @Table(name = "customer")
- @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.findByIdentification", query = "SELECT c FROM Customer c WHERE c.identification = :identification")})
- 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;
- @Column(name = "identification")
- private String identification;
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "customerId")
- private Collection<InsuranceAgent> insuranceAgentCollection;
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "customerId")
- private Collection<InsuranceVehicleOwner> insuranceVehicleOwnerCollection;
- public Customer() {
- }
- public Customer(Integer id) {
- this.id = id;
- }
- public Integer getId() {
- return id;
- }
- public void setId(Integer id) {
- this.id = id;
- }
- public String getIdentification() {
- return identification;
- }
- public void setIdentification(String identification) {
- this.identification = identification;
- }
- public Collection<InsuranceAgent> getInsuranceAgentCollection() {
- return insuranceAgentCollection;
- }
- public void setInsuranceAgentCollection(Collection<InsuranceAgent> insuranceAgentCollection) {
- this.insuranceAgentCollection = insuranceAgentCollection;
- }
- public Collection<InsuranceVehicleOwner> getInsuranceVehicleOwnerCollection() {
- return insuranceVehicleOwnerCollection;
- }
- public void setInsuranceVehicleOwnerCollection(Collection<InsuranceVehicleOwner> insuranceVehicleOwnerCollection) {
- this.insuranceVehicleOwnerCollection = insuranceVehicleOwnerCollection;
- }
- @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 "javaapplication3.Customer[id=" + id + "]";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement