package org.hoteia.qalingo.core.domain;
import javax.persistence.Embeddable;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import org.hoteia.qalingo.core.domain.impl.DomainEntity;
@Embeddable
public class CompanyStorePk extends AbstractEntity<CompanyStorePk> implements DomainEntity {
/**
* Generated UID
*/
private static final long serialVersionUID = 6823499810682356968L;
@ManyToOne(fetch = FetchType.LAZY, targetEntity = org.hoteia.qalingo.core.domain.Company.class)
@JoinColumn(name = "COMPANY_ID")
private Company company;
@ManyToOne(fetch = FetchType.LAZY, targetEntity = org.hoteia.qalingo.core.domain.Store.class)
@JoinColumn(name = "STORE_ID")
private Store store;
public CompanyStorePk() {
}
public CompanyStorePk(final Company company, final Store store) {
this.company = company;
this.store = store;
}
public Company getCompany() {
return company;
}
public void setCompany(Company company) {
this.company = company;
}
public Store getStore() {
return store;
}
public void setStore(Store store) {
this.store = store;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((company == null) ? 0 : company.hashCode());
result = prime * result + ((store == null) ? 0 : store.hashCode());
return result;
}
@Override
public boolean equals(Object sourceObj) {
Object obj = deproxy(sourceObj);
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CompanyStorePk other = (CompanyStorePk) obj;
if (store == null) {
if (other.store != null)
return false;
} else if (!store.equals(other.store))
return false;
if (company == null) {
if (other.company != null)
return false;
} else if (!company.equals(other.company))
return false;
return true;
}
}