entity
This commit is contained in:
snoop 2016-11-18 11:35:40 +09:00
parent 8d9efcade6
commit 3e0831d9ff
2 changed files with 47 additions and 2 deletions

View File

@ -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;
}

View File

@ -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<DiscoveryHost> 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<HostScanHistory> getHistories() {
return histories;
}