Subversion Repositories SmartDukaan

Rev

Rev 21573 | Blame | Last modification | View Log | RSS feed

package com.spice.profitmandi.dao.entity;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table(name="fofo.current_inventory_snapshot")
@NamedQueries({
        @NamedQuery(name = "CurrentInventorySnapshot.selectByItemId", query = "select i.id, i.brand, i.modelName, i.modelNumber, i.color, cis.availability from CurrentInventorySnapshot cis join Item i on cis.id.itemId = i.id where cis.id.itemId = :itemId"),
        @NamedQuery(name = "CurrentInventotySnapshot.selectByFofoItemId", query = "select cis from CurrentInventorySnapshot cis where cis.id.fofoId = :fofoId and cis.id.itemId = :itemId"),
        @NamedQuery(name = "CurrentInventotySnapshot.selectByFofoId", query = "select cis from CurrentInventorySnapshot cis where cis.id.fofoId = :fofoId"),
        @NamedQuery(name = "CurrentInventorySnapshot.updateAvailabilityByFofoItemId", query = "update CurrentInventorySnapshot cis set cis.availability = :availability where cis.id.fofoId = :fofoId and cis.id.itemId = :itemId")
})
public class CurrentInventorySnapshot {
        
        @Id
        @EmbeddedId
        private FofoItemId id;
        
        @Column(name = "availability")
        private int availability;
        
        public FofoItemId getId() {
                return id;
        }
        public void setId(FofoItemId id) {
                this.id = id;
        }
        public int getAvailability() {
                return availability;
        }
        public void setAvailability(int availability) {
                this.availability = availability;
        }

        
        @Override
        public String toString() {
                return "CurrentInventorySnapshot [id=" + id + ", availability=" + availability + "]";
        }
        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
                result = prime * result + availability;
                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;
                CurrentInventorySnapshot other = (CurrentInventorySnapshot) obj;
                if (availability != other.availability)
                        return false;
                if (id == null) {
                        if (other.id != null)
                                return false;
                } else if (!id.equals(other.id))
                        return false;
                return true;
        }
        
        
        
}