Subversion Repositories SmartDukaan

Rev

Rev 21924 | Rev 22859 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21720 ashik.ali 1
package com.spice.profitmandi.dao.entity.dtr;
21545 ashik.ali 2
 
3
import java.io.Serializable;
4
 
5
import javax.persistence.Column;
6
import javax.persistence.Entity;
7
import javax.persistence.GeneratedValue;
8
import javax.persistence.GenerationType;
9
import javax.persistence.Id;
10
import javax.persistence.NamedQueries;
11
import javax.persistence.NamedQuery;
12
import javax.persistence.Table;
13
import javax.persistence.UniqueConstraint;
14
 
15
/**
16
 * This class basically contains api details
17
 * 
18
 * @author ashikali
19
 *
20
 */
21
@Entity
21720 ashik.ali 22
@Table(name="dtr.retailer_brand", schema = "dtr", uniqueConstraints = {@UniqueConstraint(columnNames = {"retailer_id", "brand_id"})})
21545 ashik.ali 23
@NamedQueries({
24
	@NamedQuery(name="RetailerBrand.selectByRetailerId", query="select rb from RetailerBrand rb where rb.retailerId= :retailerId"),
25
	@NamedQuery(name="RetailerBrand.deleteByRetailerAndBrandId", query="delete from RetailerBrand rb where rb.retailerId= :retailerId and rb.brandId = :brandId"),
26
	@NamedQuery(name = "RetailerBrand.selectBrandNamesByRetailerId", query = "select b.name from RetailerBrand rb join Brand b on b.id = rb.brandId where rb.retailerId = :retailerId")
27
})
28
public class RetailerBrand implements Serializable{
29
 
30
	private static final long serialVersionUID = 1L;
31
 
32
	@Id
33
	@Column(name="id", unique=true, updatable=false)
34
	@GeneratedValue(strategy = GenerationType.IDENTITY)
35
	private int id;
36
 
37
	public RetailerBrand() {
38
	}
39
 
40
	public int getId() {
41
		return id;
42
	}
43
	public void setId(int id) {
44
		this.id = id;
45
	}
46
	@Column(name="retailer_id", unique=false, updatable=false)
47
	private int retailerId;
48
 
49
	@Column(name="brand_id", unique = false)
50
	private int brandId;
51
 
52
	public int getRetailerId() {
53
		return retailerId;
54
	}
55
 
56
	public void setRetailerId(int retailerId) {
57
		this.retailerId = retailerId;
58
	}
59
 
60
	public int getBrandId() {
61
		return brandId;
62
	}
63
	public void setBrandId(int brandId) {
64
		this.brandId = brandId;
65
	}
66
 
21924 ashik.ali 67
 
21545 ashik.ali 68
	@Override
21924 ashik.ali 69
	public int hashCode() {
70
		final int prime = 31;
71
		int result = 1;
72
		result = prime * result + brandId;
73
		result = prime * result + retailerId;
74
		return result;
75
	}
76
 
77
	@Override
78
	public boolean equals(Object obj) {
79
		if (this == obj)
80
			return true;
81
		if (obj == null)
82
			return false;
83
		if (getClass() != obj.getClass())
84
			return false;
85
		RetailerBrand other = (RetailerBrand) obj;
86
		if (brandId != other.brandId)
87
			return false;
88
		if (retailerId != other.retailerId)
89
			return false;
90
		return true;
91
	}
92
 
93
	@Override
21545 ashik.ali 94
	public String toString() {
95
		return "RetailerBrand [retailerId=" + retailerId + ", brandId=" + brandId + "]";
96
	}
97
 
98
}