Subversion Repositories SmartDukaan

Rev

Rev 21602 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.dao.entity;

import java.io.Serializable;
import java.time.LocalDateTime;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.persistence.Version;

/**
 * This class basically contains api details
 * 
 * @author ashikali
 *
 */
@Entity
@Table(name="shop", schema = "dtr", uniqueConstraints = {@UniqueConstraint(columnNames = {"name","retailer_id", "document_id", "address_id"})})
@NamedQueries({
        @NamedQuery(name = "Shop.selectCount", query = "select count(s) from Shop s"),
        @NamedQuery(name="Shop.selectAll",query="select s from Shop s"),
        @NamedQuery(name="Shop.selectById",query="select s from Shop s where s.id= :id"),
        @NamedQuery(name="Shop.selectByName",query="select s from Shop s where s.name= :name"),
        @NamedQuery(name="Shop.selectByRetailerId",query="select s from Shop s where s.retailerId= :retailerId"),
        @NamedQuery(name="Shop.selectByDocumentId",query="select s from Shop s where s.documentId= :documentId"),
        @NamedQuery(name = "Shop.selectCountByDocumentId", query = "select count(s) from Shop s where s.documentId= :documentId"),
        @NamedQuery(name="Shop.deleteById",query="delete from Shop s where s.id= :id"),
        @NamedQuery(name="Shop.deleteByShopAndRetailerId",query="delete from Shop s where s.id= :id and s.retailerId = :retailerId")
})
public class Shop implements Serializable{
        
        private static final long serialVersionUID = 1L;
        
        public Shop() {
        }
        
        @Id
        @Column(name="id", unique=true, updatable=false)
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private int id;
        
        @Column(name="name")
        private String name;
        
        @Column(name = "retailer_id")
        private int retailerId;
        
        @Column(name = "document_id")
        private int documentId;
        
        @Column(name = "address_id")
        private int addressId;
        
        @Column(name="create_timestamp", updatable = false)
        private LocalDateTime createTimestamp = LocalDateTime.now();
        
        @Column(name="update_timestamp")
        private LocalDateTime updateTimestamp = LocalDateTime.now();
        
        @Basic(optional = false)
    @Column(nullable = false)
        @Version
        private int version;
        
        public int getId() {
                return id;
        }
        public void setId(int id) {
                this.id = id;
        }
        public void setName(String name) {
        this.name = name;
    }
    public String getName() {
        return name;
    }
    
    public int getRetailerId() {
                return retailerId;
        }
    public void setRetailerId(int retailerId) {
                this.retailerId = retailerId;
        }
    
    public int getDocumentId() {
                return documentId;
        }
    public void setDocumentId(int documentId) {
                this.documentId = documentId;
        }
    public void setAddressId(int addressId) {
                this.addressId = addressId;
        }
    public int getAddressId() {
                return addressId;
        }
    
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
                this.createTimestamp = createTimestamp;
        }
    public LocalDateTime getCreateTimestamp() {
                return createTimestamp;
        }
    
    public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
                this.updateTimestamp = updateTimestamp;
        }
    public LocalDateTime getUpdateTimestamp() {
                return updateTimestamp;
        }
    
    
    public void setVersion(int version) {
                this.version = version;
        }
    public int getVersion() {
                return version;
        }
            
}