From 9bea83bb2ff173055ebd70d5123b64022b3ad038 Mon Sep 17 00:00:00 2001 From: insanity Date: Mon, 21 Aug 2017 19:43:20 +0900 Subject: [PATCH] infra type string to int(child id) --- .../overflow/module/infra/model/Infra.java | 21 ++++++++-------- src/main/resources/init.sql | 24 +++++++++---------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/loafle/overflow/module/infra/model/Infra.java b/src/main/java/com/loafle/overflow/module/infra/model/Infra.java index 3e4d17d..6ab1032 100644 --- a/src/main/java/com/loafle/overflow/module/infra/model/Infra.java +++ b/src/main/java/com/loafle/overflow/module/infra/model/Infra.java @@ -1,6 +1,7 @@ package com.loafle.overflow.module.infra.model; +import com.loafle.overflow.module.meta.model.MetaInfraType; import com.loafle.overflow.module.probe.model.Probe; import com.loafle.overflow.module.target.model.Target; @@ -16,7 +17,7 @@ import java.util.Date; @DiscriminatorColumn(name = "INFRA_TYPE", discriminatorType = DiscriminatorType.INTEGER) public abstract class Infra { private long id; -// private MetaInfraType infraType; + private MetaInfraType infraType; // private long childId; private Date createDate; private Probe probe; @@ -96,15 +97,15 @@ public abstract class Infra { this.id = id; } -// @ManyToOne -// @JoinColumn(name = "TYPE_ID", nullable = false) -// public MetaInfraType getInfraType() { -// return infraType; -// } -// -// public void setInfraType(MetaInfraType infraType) { -// this.infraType = infraType; -// } + @ManyToOne + @JoinColumn(name = "TYPE_ID", nullable = false) + public MetaInfraType getInfraType() { + return infraType; + } + + public void setInfraType(MetaInfraType infraType) { + this.infraType = infraType; + } // @Basic // @Column(name = "CHILD_ID", nullable = false) diff --git a/src/main/resources/init.sql b/src/main/resources/init.sql index 8e18d90..70b1173 100644 --- a/src/main/resources/init.sql +++ b/src/main/resources/init.sql @@ -406,18 +406,18 @@ INSERT INTO public.probe (authorize_date,cidr,create_date,description,display_na INSERT INTO public.target (create_date,description,display_name) VALUES ( '2017-07-27 20:18:09.555','i am target','ghost target'); -INSERT INTO public.infra (infra_type,create_date,probe_id,target_id) VALUES ( -1,'2017-08-21 12:59:10.244',1,1); -INSERT INTO public.infra (infra_type,create_date,probe_id,target_id) VALUES ( -3,'2017-08-21 13:05:24.883',1,1); -INSERT INTO public.infra (infra_type,create_date,probe_id,target_id) VALUES ( -2,'2017-08-21 14:20:01.830',1,1); -INSERT INTO public.infra (infra_type,create_date,probe_id,target_id) VALUES ( -7,'2017-08-21 14:24:26.525',1,1); -INSERT INTO public.infra (infra_type,create_date,probe_id,target_id) VALUES ( -4,'2017-08-21 14:27:19.474',1,1); -INSERT INTO public.infra (infra_type,create_date,probe_id,target_id) VALUES ( -5,'2017-08-21 14:28:48.761',1,1); +INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES ( +1,'2017-08-21 12:59:10.244',1,1,1); +INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES ( +3,'2017-08-21 13:05:24.883',3,1,1); +INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES ( +2,'2017-08-21 14:20:01.830',2,1,1); +INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES ( +7,'2017-08-21 14:24:26.525',7,1,1); +INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES ( +4,'2017-08-21 14:27:19.474',4,1,1); +INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES ( +5,'2017-08-21 14:28:48.761',5,1,1); INSERT INTO public.infra_machine (meta,id) VALUES (