clean or mapping

This commit is contained in:
peter 2013-04-30 22:11:59 +02:00
parent 953938a033
commit 14645dc911
2 changed files with 15 additions and 39 deletions

View File

@ -18,17 +18,11 @@ public class Component implements Serializable {
private static final long serialVersionUID = 970709621200712794L;
@Id
@Column(name="basepacket_id", insertable=false, updatable=false)
private long basePacId;
@Id
@Column(name="basecomponent_id", insertable=false, updatable=false)
private long baseComponentId;
@ManyToOne
@JoinColumn(name="basepacket_id")
private BasePac basePac;
@Id
@ManyToOne
@JoinColumn(name="basecomponent_id")
private BaseComponent baseComponent;
@ -62,7 +56,6 @@ public class Component implements Serializable {
}
public void setBasePac(BasePac basePac) {
this.setBasePacId(basePac.id());
this.basePac = basePac;
}
@ -71,7 +64,6 @@ public class Component implements Serializable {
}
public void setBaseComponent(BaseComponent baseComponent) {
this.setBaseComponentId(baseComponent.id());
this.baseComponent = baseComponent;
}
@ -123,22 +115,6 @@ public class Component implements Serializable {
this.adminOnly = adminOnly;
}
public void setBasePacId(long basePacId) {
this.basePacId = basePacId;
}
public long getBasePacId() {
return basePacId;
}
public void setBaseComponentId(long baseComponentId) {
this.baseComponentId = baseComponentId;
}
public long getBaseComponentId() {
return baseComponentId;
}
public int getArticleNumber() {
return articleNumber;
}

View File

@ -7,45 +7,45 @@ public class ComponentId implements Serializable {
private static final long serialVersionUID = 6213446997257985587L;
private long basePacId;
private long baseComponentId;
private long basePac;
private long baseComponent;
public ComponentId() {
}
public ComponentId(long basePacId, long baseComponentId) {
this.setBasePacId(basePacId);
this.setBaseComponentId(baseComponentId);
this.setBasePac(basePacId);
this.setBaseComponent(baseComponentId);
}
@Override
public boolean equals(Object obj) {
if (obj != null && obj instanceof ComponentId) {
ComponentId other = (ComponentId) obj;
return getBasePacId() == other.getBasePacId() && getBaseComponentId() == other.getBaseComponentId();
return getBasePac() == other.getBasePac() && getBaseComponent() == other.getBaseComponent();
}
return false;
}
@Override
public int hashCode() {
return (new Long(getBasePacId() ^ getBaseComponentId() % Integer.MAX_VALUE)).intValue();
return (new Long(getBasePac() ^ getBaseComponent() % Integer.MAX_VALUE)).intValue();
}
public void setBasePacId(long basePacId) {
this.basePacId = basePacId;
public void setBasePac(long basePacId) {
this.basePac = basePacId;
}
public long getBasePacId() {
return basePacId;
public long getBasePac() {
return basePac;
}
public void setBaseComponentId(long baseComponentId) {
this.baseComponentId = baseComponentId;
public void setBaseComponent(long baseComponentId) {
this.baseComponent = baseComponentId;
}
public long getBaseComponentId() {
return baseComponentId;
public long getBaseComponent() {
return baseComponent;
}
}