found one more mapping error with migrated database
This commit is contained in:
parent
d305c64646
commit
71bd2b5ad3
@ -49,7 +49,7 @@ public class Pac extends AbstractEntity implements Serializable {
|
||||
private String name;
|
||||
|
||||
@JoinColumn(name = "bp_id")
|
||||
@ManyToOne(fetch = EAGER)
|
||||
@ManyToOne(fetch = LAZY)
|
||||
private Customer customer;
|
||||
|
||||
@JoinColumn(name = "basepacket_id")
|
||||
@ -79,7 +79,7 @@ public class Pac extends AbstractEntity implements Serializable {
|
||||
@ManyToOne(fetch = EAGER)
|
||||
private INetAddress oldINetAddr;
|
||||
|
||||
@OneToMany(fetch = EAGER, cascade = ALL, mappedBy="pac")
|
||||
@OneToMany(fetch = EAGER, cascade = ALL, mappedBy="pac", orphanRemoval=true)
|
||||
private Set<PacComponent> pacComponents;
|
||||
|
||||
@OneToMany(fetch = LAZY, cascade = ALL, mappedBy="pac")
|
||||
@ -95,7 +95,7 @@ public class Pac extends AbstractEntity implements Serializable {
|
||||
for (Component comp : basePac.getComponents()) {
|
||||
PacComponent pacComp = new PacComponent();
|
||||
pacComp.setCreated(today);
|
||||
pacComp.setComponent(comp);
|
||||
pacComp.setBaseComponent(comp.getBaseComponent());
|
||||
pacComp.setPac(this);
|
||||
if (setDefaults) {
|
||||
pacComp.setQuantity(comp.getDefaultQuantity());
|
||||
|
@ -34,7 +34,7 @@ public class PacComponent implements Serializable {
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "basecomponent_id")
|
||||
private Component component;
|
||||
private BaseComponent baseComponent;
|
||||
|
||||
@Column(name = "quantity", columnDefinition = "integer")
|
||||
private int quantity;
|
||||
@ -52,7 +52,11 @@ public class PacComponent implements Serializable {
|
||||
}
|
||||
|
||||
public BaseComponent getBaseComponent() {
|
||||
return getComponent().getBaseComponent();
|
||||
return baseComponent;
|
||||
}
|
||||
|
||||
public void setBaseComponent(BaseComponent baseComponent) {
|
||||
this.baseComponent = baseComponent;
|
||||
}
|
||||
|
||||
public Pac getPac() {
|
||||
@ -87,17 +91,9 @@ public class PacComponent implements Serializable {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
public Component getComponent() {
|
||||
return component;
|
||||
}
|
||||
|
||||
public void setComponent(Component component) {
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "pac=" + pac.getName() + ";comp=" + component.getBaseComponent().getFeature() + ";quantity=" + getQuantity();
|
||||
return "pac=" + pac.getName() + ";comp=" + getBaseComponent().getFeature() + ";quantity=" + getQuantity();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class PacModuleImpl extends AbstractModuleImpl {
|
||||
Component comp = (Component) cObj;
|
||||
PacComponent pacComponent = new PacComponent();
|
||||
BaseComponent baseComponent = comp.getBaseComponent();
|
||||
pacComponent.setComponent(comp);
|
||||
pacComponent.setBaseComponent(comp.getBaseComponent());
|
||||
pacComponent.setCreated(now);
|
||||
pacComponent.setPac(pac);
|
||||
String feature = baseComponent.getFeature();
|
||||
|
Loading…
Reference in New Issue
Block a user