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; private static final long serialVersionUID = 970709621200712794L;
@Id @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 @ManyToOne
@JoinColumn(name="basepacket_id") @JoinColumn(name="basepacket_id")
private BasePac basePac; private BasePac basePac;
@Id
@ManyToOne @ManyToOne
@JoinColumn(name="basecomponent_id") @JoinColumn(name="basecomponent_id")
private BaseComponent baseComponent; private BaseComponent baseComponent;
@ -62,7 +56,6 @@ public class Component implements Serializable {
} }
public void setBasePac(BasePac basePac) { public void setBasePac(BasePac basePac) {
this.setBasePacId(basePac.id());
this.basePac = basePac; this.basePac = basePac;
} }
@ -71,7 +64,6 @@ public class Component implements Serializable {
} }
public void setBaseComponent(BaseComponent baseComponent) { public void setBaseComponent(BaseComponent baseComponent) {
this.setBaseComponentId(baseComponent.id());
this.baseComponent = baseComponent; this.baseComponent = baseComponent;
} }
@ -123,22 +115,6 @@ public class Component implements Serializable {
this.adminOnly = adminOnly; 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() { public int getArticleNumber() {
return articleNumber; return articleNumber;
} }

View File

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