Subversion Repositories SmartDukaan

Rev

Rev 22859 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.dao.entity.dtr;

import java.io.Serializable;

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

/**
 * This class basically contains api details
 * 
 * @author ashikali
 *
 */
@Entity
@Table(name="dtr.retailer_brand", uniqueConstraints = {@UniqueConstraint(columnNames = {"retailer_id", "brand_id"})})
@NamedQueries({
        @NamedQuery(name="RetailerBrand.selectByRetailerId", query="select rb from RetailerBrand rb where rb.retailerId= :retailerId"),
        @NamedQuery(name="RetailerBrand.deleteByRetailerAndBrandId", query="delete from RetailerBrand rb where rb.retailerId= :retailerId and rb.brandId = :brandId"),
        @NamedQuery(name = "RetailerBrand.selectBrandNamesByRetailerId", query = "select b.name from RetailerBrand rb join Brand b on b.id = rb.brandId where rb.retailerId = :retailerId")
})
public class RetailerBrand implements Serializable{
        
        private static final long serialVersionUID = 1L;
        
        public RetailerBrand() {
        }
        
        @Id
        @Column(name="retailer_id", unique=false, updatable=false)
        private int retailerId;
        
        @Id
        @Column(name="brand_id", unique = false)
        private int brandId;

        public int getRetailerId() {
                return retailerId;
        }

        public void setRetailerId(int retailerId) {
                this.retailerId = retailerId;
        }

        public int getBrandId() {
                return brandId;
        }
        public void setBrandId(int brandId) {
                this.brandId = brandId;
        }

        
        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
                result = prime * result + brandId;
                result = prime * result + retailerId;
                return result;
        }

        @Override
        public boolean equals(Object obj) {
                if (this == obj)
                        return true;
                if (obj == null)
                        return false;
                if (getClass() != obj.getClass())
                        return false;
                RetailerBrand other = (RetailerBrand) obj;
                if (brandId != other.brandId)
                        return false;
                if (retailerId != other.retailerId)
                        return false;
                return true;
        }

        @Override
        public String toString() {
                return "RetailerBrand [retailerId=" + retailerId + ", brandId=" + brandId + "]";
        }
        
}