From 3e0831d9fff9b33b86c9119b1de0d099aff682f0 Mon Sep 17 00:00:00 2001 From: snoop Date: Fri, 18 Nov 2016 11:35:40 +0900 Subject: [PATCH] fixed entity --- .../discoveryhistory/DiscoveryHistory.java | 24 +++++++++++++++++- .../bridge/discoveryzone/DiscoveryZone.java | 25 ++++++++++++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/loafle/bridge/discoveryhistory/DiscoveryHistory.java b/src/main/java/com/loafle/bridge/discoveryhistory/DiscoveryHistory.java index fe08b2b..c0255a8 100644 --- a/src/main/java/com/loafle/bridge/discoveryhistory/DiscoveryHistory.java +++ b/src/main/java/com/loafle/bridge/discoveryhistory/DiscoveryHistory.java @@ -24,10 +24,32 @@ public class DiscoveryHistory @Column(nullable=false) private Boolean result; - @JoinColumn + @JoinColumn(nullable=false) @OneToOne(mappedBy = "discovery",cascade = CascadeType.ALL) private DiscoveryZone zone; + @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false, insertable = false, updatable = false) + private Date createDate; + + @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false, insertable = false) + private Date updateDate; + + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + public Date getUpdateDate() { + return updateDate; + } + + public void setUpdateDate(Date updateDate) { + this.updateDate = updateDate; + } + public DiscoveryZone getZone() { return zone; } diff --git a/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java b/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java index 07f29ea..de8fad9 100644 --- a/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java +++ b/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java @@ -5,6 +5,7 @@ import com.loafle.bridge.discoveryhistory.DiscoveryHistory; import com.loafle.bridge.discoveryhost.DiscoveryHost; import javax.persistence.*; +import java.util.Date; import java.util.List; /** @@ -24,7 +25,7 @@ public class DiscoveryZone { @Column(nullable=false) private long cidr; - @JoinColumn + @JoinColumn(nullable=false) @OneToOne @JsonIgnore private DiscoveryHistory discovery; @@ -35,6 +36,28 @@ public class DiscoveryZone { @OneToMany(mappedBy = "zone", cascade = CascadeType.ALL) private List discoveryHosts; + @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false, insertable = false, updatable = false) + private Date createDate; + + @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false, insertable = false, updatable = false) + private Date updateDate; + + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + public Date getUpdateDate() { + return updateDate; + } + + public void setUpdateDate(Date updateDate) { + this.updateDate = updateDate; + } + public List getHistories() { return histories; }