package banco.modelo;
import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;
@Entity
public class FormaPagtoUtilizada implements Serializable{
private static final long serialVersionUID = -2216864617210689815L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
@Column
@NotNull(message="Informe o valor.")
private BigDecimal valor = BigDecimal.ZERO;
@ManyToOne
@NotNull(message="Selecione uma forma de pagamento.")
private FormaPagamento formaPagamento;
@ManyToOne
@JoinColumn(name="servicoPrestado_id")
private ServicoPrestado servicoPrestado;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public BigDecimal getValor() {
return valor;
}
public void setValor(BigDecimal valor) {
this.valor = valor;
}
public FormaPagamento getFormaPagamento() {
return formaPagamento;
}
public void setFormaPagamento(FormaPagamento formaPagamento) {
this.formaPagamento = formaPagamento;
}
public ServicoPrestado getServicoPrestado() {
return servicoPrestado;
}
public void setServicoPrestado(ServicoPrestado servicoPrestado) {
this.servicoPrestado = servicoPrestado;
}
@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;
FormaPagtoUtilizada other = (FormaPagtoUtilizada) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}