/* * The MIT License * * Copyright 2012 Universidad de Montemorelos A. C. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package mx.edu.um.mateo.inventario.model; 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.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.UniqueConstraint; import javax.persistence.Version; /** * * @author J. David Mendoza <jdmendoza@um.edu.mx> */ @Entity @Table(name = "historial_producto", uniqueConstraints = { @UniqueConstraint(columnNames = { "fecha", "producto_id" }) }) public class HistorialProducto implements Serializable { /** * */ private static final long serialVersionUID = -1936753628279640897L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Version private Integer version; @Temporal(TemporalType.DATE) @Column(nullable = false) private Date fecha; @Column(nullable = false, name = "producto_id") private Long productoId; @Column(nullable = false) private BigDecimal existencia; @ManyToOne(optional = false) private Almacen almacen; public HistorialProducto() { } public HistorialProducto(Long productoId, Almacen almacen) { this.productoId = productoId; this.almacen = almacen; } /** * @return the id */ public Long getId() { return id; } /** * @param id * the id to set */ public void setId(Long id) { this.id = id; } /** * @return the version */ public Integer getVersion() { return version; } /** * @param version * the version to set */ public void setVersion(Integer version) { this.version = version; } /** * @return the fecha */ public Date getFecha() { return fecha; } /** * @param fecha * the fecha to set */ public void setFecha(Date fecha) { this.fecha = fecha; } /** * @return the productoId */ public Long getProductoId() { return productoId; } /** * @param productoId * the productoId to set */ public void setProductoId(Long productoId) { this.productoId = productoId; } /** * @return the existencia */ public BigDecimal getExistencia() { return existencia; } /** * @param existencia * the existencia to set */ public void setExistencia(BigDecimal existencia) { this.existencia = existencia; } /** * @return the almacen */ public Almacen getAlmacen() { return almacen; } /** * @param almacen * the almacen to set */ public void setAlmacen(Almacen almacen) { this.almacen = almacen; } }