From 14cdf606cd29479f07a2a3f50f19a7de751b34e6 Mon Sep 17 00:00:00 2001 From: snoop Date: Thu, 17 Nov 2016 19:13:52 +0900 Subject: [PATCH] fixed ignorejson --- .../java/com/loafle/bridge/discoveryhost/DiscoveryHost.java | 2 ++ .../com/loafle/bridge/discoveryhost/PortScanHistory.java | 2 ++ .../java/com/loafle/bridge/discoveryport/DiscoveryPort.java | 2 ++ .../com/loafle/bridge/discoveryport/ServiceScanHistory.java | 2 ++ .../loafle/bridge/discoveryservice/DiscoveryService.java | 2 ++ .../java/com/loafle/bridge/discoveryzone/DiscoveryZone.java | 2 ++ .../com/loafle/bridge/discoveryzone/HostScanHistory.java | 6 +++++- src/main/resources/database.properties | 2 +- 8 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHost.java b/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHost.java index a74546d..b5b024d 100644 --- a/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHost.java +++ b/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHost.java @@ -1,5 +1,6 @@ package com.loafle.bridge.discoveryhost; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.loafle.bridge.discoveryport.DiscoveryPort; import com.loafle.bridge.discoveryzone.DiscoveryZone; @@ -25,6 +26,7 @@ public class DiscoveryHost { @ManyToOne @JoinColumn(name = "ZONE_ID", nullable = false) + @JsonIgnore private DiscoveryZone zone; public DiscoveryZone getZone() { diff --git a/src/main/java/com/loafle/bridge/discoveryhost/PortScanHistory.java b/src/main/java/com/loafle/bridge/discoveryhost/PortScanHistory.java index 7435108..bad096c 100644 --- a/src/main/java/com/loafle/bridge/discoveryhost/PortScanHistory.java +++ b/src/main/java/com/loafle/bridge/discoveryhost/PortScanHistory.java @@ -1,5 +1,6 @@ package com.loafle.bridge.discoveryhost; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.loafle.bridge.discoveryport.type.DirectionType; import com.loafle.bridge.discoveryport.type.PortType; @@ -18,6 +19,7 @@ public class PortScanHistory { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn + @JsonIgnore private DiscoveryHost host; public DiscoveryHost getHost() { diff --git a/src/main/java/com/loafle/bridge/discoveryport/DiscoveryPort.java b/src/main/java/com/loafle/bridge/discoveryport/DiscoveryPort.java index b8ddd55..9a4cf0c 100644 --- a/src/main/java/com/loafle/bridge/discoveryport/DiscoveryPort.java +++ b/src/main/java/com/loafle/bridge/discoveryport/DiscoveryPort.java @@ -1,5 +1,6 @@ package com.loafle.bridge.discoveryport; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.loafle.bridge.discoveryhost.DiscoveryHost; import com.loafle.bridge.discoveryport.type.PortType; import com.loafle.bridge.discoveryservice.DiscoveryService; @@ -17,6 +18,7 @@ public class DiscoveryPort { @ManyToOne @JoinColumn + @JsonIgnore private DiscoveryHost host; public DiscoveryHost getHost() { return host; diff --git a/src/main/java/com/loafle/bridge/discoveryport/ServiceScanHistory.java b/src/main/java/com/loafle/bridge/discoveryport/ServiceScanHistory.java index fd590a9..5922821 100644 --- a/src/main/java/com/loafle/bridge/discoveryport/ServiceScanHistory.java +++ b/src/main/java/com/loafle/bridge/discoveryport/ServiceScanHistory.java @@ -1,5 +1,6 @@ package com.loafle.bridge.discoveryport; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.loafle.bridge.discoveryport.type.DirectionType; import javax.persistence.*; @@ -22,6 +23,7 @@ public class ServiceScanHistory { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn + @JsonIgnore private DiscoveryPort port; diff --git a/src/main/java/com/loafle/bridge/discoveryservice/DiscoveryService.java b/src/main/java/com/loafle/bridge/discoveryservice/DiscoveryService.java index 7c124f7..b57e0b2 100644 --- a/src/main/java/com/loafle/bridge/discoveryservice/DiscoveryService.java +++ b/src/main/java/com/loafle/bridge/discoveryservice/DiscoveryService.java @@ -1,5 +1,6 @@ package com.loafle.bridge.discoveryservice; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.loafle.bridge.discoveryport.DiscoveryPort; import com.loafle.bridge.discoveryport.type.PortType; @@ -17,6 +18,7 @@ public class DiscoveryService { @ManyToOne @JoinColumn(nullable = false) + @JsonIgnore private DiscoveryPort port; public DiscoveryPort getPort() { return port; diff --git a/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java b/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java index b3b7aa6..07f29ea 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.fasterxml.jackson.annotation.JsonIgnore; import com.loafle.bridge.discoveryhistory.DiscoveryHistory; import com.loafle.bridge.discoveryhost.DiscoveryHost; @@ -25,6 +26,7 @@ public class DiscoveryZone { @JoinColumn @OneToOne + @JsonIgnore private DiscoveryHistory discovery; @OneToMany(mappedBy = "zone", cascade = CascadeType.ALL) diff --git a/src/main/java/com/loafle/bridge/discoveryzone/HostScanHistory.java b/src/main/java/com/loafle/bridge/discoveryzone/HostScanHistory.java index 958a138..1143ba0 100644 --- a/src/main/java/com/loafle/bridge/discoveryzone/HostScanHistory.java +++ b/src/main/java/com/loafle/bridge/discoveryzone/HostScanHistory.java @@ -1,5 +1,8 @@ package com.loafle.bridge.discoveryzone; +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; + import javax.persistence.*; import java.util.Date; @@ -33,8 +36,9 @@ public class HostScanHistory { @Column private String description; - @ManyToOne(fetch = FetchType.LAZY) + @ManyToOne(fetch = FetchType.LAZY, optional = false) @JoinColumn + @JsonIgnore private DiscoveryZone zone; public long getId() { diff --git a/src/main/resources/database.properties b/src/main/resources/database.properties index 07b3361..7e87538 100644 --- a/src/main/resources/database.properties +++ b/src/main/resources/database.properties @@ -10,7 +10,7 @@ spring.datasource.driver-class-name=org.h2.Driver ## Hibernate configuration spring.jpa.database=h2 -spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.hibernate.ddl-auto=create #spring.jpa.hibernate.ddl-auto=update spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy spring.jpa.show-sql=true \ No newline at end of file