diff --git a/src/main/java/com/loafle/bridge/discoveryhistory/DiscoveryHistory.java b/src/main/java/com/loafle/bridge/discoveryhistory/DiscoveryHistory.java index ccc2ed6..fe08b2b 100644 --- a/src/main/java/com/loafle/bridge/discoveryhistory/DiscoveryHistory.java +++ b/src/main/java/com/loafle/bridge/discoveryhistory/DiscoveryHistory.java @@ -25,7 +25,7 @@ public class DiscoveryHistory private Boolean result; @JoinColumn - @OneToOne(cascade = CascadeType.ALL) + @OneToOne(mappedBy = "discovery",cascade = CascadeType.ALL) private DiscoveryZone zone; public DiscoveryZone getZone() { diff --git a/src/main/java/com/loafle/bridge/discoveryport/DiscoveryPortController.java b/src/main/java/com/loafle/bridge/discoveryport/DiscoveryPortController.java index 08ed111..08b5ad8 100644 --- a/src/main/java/com/loafle/bridge/discoveryport/DiscoveryPortController.java +++ b/src/main/java/com/loafle/bridge/discoveryport/DiscoveryPortController.java @@ -64,6 +64,7 @@ public class DiscoveryPortController { String ip = "3232235983"; z.setCidr(Long.parseLong(cidr)); z.setIp(Long.parseLong(ip)); + z.setDiscovery(d); d.setZone(z); // host scan histories diff --git a/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java b/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java index 2015d7d..9e5e983 100644 --- a/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java +++ b/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java @@ -1,5 +1,6 @@ package com.loafle.bridge.discoveryzone; +import com.loafle.bridge.discoveryhistory.DiscoveryHistory; import com.loafle.bridge.discoveryhost.DiscoveryHost; import javax.persistence.*; @@ -22,6 +23,10 @@ public class DiscoveryZone { @Column(nullable=false) private long cidr; + @JoinColumn + @OneToOne + private DiscoveryHistory discovery; + @OneToMany(mappedBy = "zone", cascade = CascadeType.ALL) private List hostScanHistories; @@ -67,4 +72,12 @@ public class DiscoveryZone { public void setCidr(long cidr) { this.cidr = cidr; } + + public DiscoveryHistory getDiscovery() { + return discovery; + } + + public void setDiscovery(DiscoveryHistory discovery) { + this.discovery = discovery; + } }