From 3cdc4b2ccfb8ced1526bf2ead8f6233dcd2e3ea3 Mon Sep 17 00:00:00 2001 From: jackdaw Date: Thu, 17 Nov 2016 17:03:53 +0900 Subject: [PATCH] .test insert controller method --- .../bridge/discoveryhistory/DiscoveryHistory.java | 2 +- .../discoveryport/DiscoveryPortController.java | 1 + .../loafle/bridge/discoveryzone/DiscoveryZone.java | 13 +++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) 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; + } }