package banco.modelo;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
public class Duplicata implements Serializable{
/**
*
*/
private static final long serialVersionUID = -8776365347618416726L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
@Column
private String numero;
@Column
private BigDecimal valor = BigDecimal.ZERO;
@Temporal(TemporalType.TIMESTAMP)
private Date dataVencimento;
@Column
private boolean pago = false;
@ManyToOne
private ServicoPrestado servicoPrestado;
@ManyToOne
private Usuario usuario;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNumero() {
return numero;
}
public void setNumero(String numero) {
this.numero = numero;
}
public BigDecimal getValor() {
return valor;
}
public void setValor(BigDecimal valor) {
this.valor = valor;
}
public Date getDataVencimento() {
return dataVencimento;
}
public void setDataVencimento(Date dataVencimento) {
this.dataVencimento = dataVencimento;
}
public boolean isPago() {
return pago;
}
public void setPago(boolean pago) {
this.pago = pago;
}
public ServicoPrestado getServicoPrestado() {
return servicoPrestado;
}
public void setServicoPrestado(ServicoPrestado servicoPrestado) {
this.servicoPrestado = servicoPrestado;
}
public Usuario getUsuario() {
return usuario;
}
public void setUsuario(Usuario usuario) {
this.usuario = usuario;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Duplicata other = (Duplicata) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}