From 8bafd55e7168d74c5f78f62cb197cc13e67d5571 Mon Sep 17 00:00:00 2001 From: geek Date: Fri, 18 Nov 2016 11:31:25 +0900 Subject: [PATCH] host jpa option edited --- .../bridge/discoveryhost/DiscoveryHost.java | 1 + .../discoveryhost/DiscoveryHostController.java | 16 ++++++++++++++++ .../bridge/discoveryhost/PortScanHistory.java | 6 +++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHost.java b/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHost.java index b5b024d..00dbcb0 100644 --- a/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHost.java +++ b/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHost.java @@ -67,6 +67,7 @@ public class DiscoveryHost { public DiscoveryHost(){} + public DiscoveryHost(long ip, long mac){ this.ip = ip; this.mac = mac; diff --git a/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHostController.java b/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHostController.java index b6c7e0d..170b8e0 100644 --- a/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHostController.java +++ b/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHostController.java @@ -1,7 +1,23 @@ package com.loafle.bridge.discoveryhost; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.transaction.Transactional; + /** * Created by root on 16. 11. 15. */ +@RestController public class DiscoveryHostController { + + @Autowired + private DiscoveryHostRepository repository; + + @RequestMapping(value ="/hostTest") + @Transactional + public void testHost() { + + } } diff --git a/src/main/java/com/loafle/bridge/discoveryhost/PortScanHistory.java b/src/main/java/com/loafle/bridge/discoveryhost/PortScanHistory.java index bad096c..10a79c4 100644 --- a/src/main/java/com/loafle/bridge/discoveryhost/PortScanHistory.java +++ b/src/main/java/com/loafle/bridge/discoveryhost/PortScanHistory.java @@ -18,7 +18,7 @@ public class PortScanHistory { private long id; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn + @JoinColumn(name = "HOST_ID", nullable = false) @JsonIgnore private DiscoveryHost host; @@ -44,10 +44,10 @@ public class PortScanHistory { @Column(nullable = true) private String description; - @Column(nullable = true) + @Column(nullable = false) private Date startDate; - @Column(nullable = true) + @Column(nullable = false) private Date endDate; @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false, insertable = false, updatable = false)