From 047d057541c4dc4719fb24f7f923217358a9db4f Mon Sep 17 00:00:00 2001 From: geek Date: Tue, 6 Jun 2017 19:30:58 +0900 Subject: [PATCH] email dao added --- .../loafle/overflow/email/model/EmailAuth.java | 2 +- .../overflow/email/dao/JPAEmailAuthDAOTest.java | 16 ++++++++++++++-- src/test/resources/META-INF/persistence.xml | 3 ++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/loafle/overflow/email/model/EmailAuth.java b/src/main/java/com/loafle/overflow/email/model/EmailAuth.java index 8edba70..2b3e689 100644 --- a/src/main/java/com/loafle/overflow/email/model/EmailAuth.java +++ b/src/main/java/com/loafle/overflow/email/model/EmailAuth.java @@ -30,7 +30,7 @@ public class EmailAuth implements Serializable { @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) private Date createDate; - @Column(name = "UPDATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = true, updatable = true) + @Column(name = "UPDATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = true) private Date updateDate; @Column(name = "CONFIRM_DATE") diff --git a/src/test/java/com/loafle/overflow/email/dao/JPAEmailAuthDAOTest.java b/src/test/java/com/loafle/overflow/email/dao/JPAEmailAuthDAOTest.java index 9c267bb..cfd3d38 100644 --- a/src/test/java/com/loafle/overflow/email/dao/JPAEmailAuthDAOTest.java +++ b/src/test/java/com/loafle/overflow/email/dao/JPAEmailAuthDAOTest.java @@ -26,12 +26,24 @@ public class JPAEmailAuthDAOTest { public void createEmailAuth() { EmailAuth auth = new EmailAuth(); - auth.setAuthToken("loafle.com/Auth"); + auth.setAuthToken("loafle.com/Auth111"); auth.setMember(new Member(Long.valueOf(1))); auth.setInvalid(false); - auth.setUpdateDate(new Date()); +// auth.setUpdateDate(new Date()); EmailAuth ret = emailAuthDAO.create(auth); System.out.println(ret.getId()); } + + @Test + public void updateEmailAuth() { + EmailAuth auth = this.emailAuthDAO.find("1"); + + auth.setInvalid(true); + auth.setUpdateDate(new Date()); + auth.setConfirmDate(new Date()); + + this.emailAuthDAO.update(auth); + System.out.println(auth.getConfirmDate()); + } } \ No newline at end of file diff --git a/src/test/resources/META-INF/persistence.xml b/src/test/resources/META-INF/persistence.xml index ef79389..d050fad 100644 --- a/src/test/resources/META-INF/persistence.xml +++ b/src/test/resources/META-INF/persistence.xml @@ -7,13 +7,14 @@ com.loafle.overflow.noauthagent.model.NoAuthAgent com.loafle.overflow.apikey.model.Apikey com.loafle.overflow.agent.model.Agent + com.loafle.overflow.email.model.EmailAuth - +