email dao added

This commit is contained in:
geek 2017-06-06 19:30:58 +09:00
parent 0257b70c51
commit 047d057541
3 changed files with 17 additions and 4 deletions

View File

@ -30,7 +30,7 @@ public class EmailAuth implements Serializable {
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
private Date createDate; 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; private Date updateDate;
@Column(name = "CONFIRM_DATE") @Column(name = "CONFIRM_DATE")

View File

@ -26,12 +26,24 @@ public class JPAEmailAuthDAOTest {
public void createEmailAuth() { public void createEmailAuth() {
EmailAuth auth = new EmailAuth(); EmailAuth auth = new EmailAuth();
auth.setAuthToken("loafle.com/Auth"); auth.setAuthToken("loafle.com/Auth111");
auth.setMember(new Member(Long.valueOf(1))); auth.setMember(new Member(Long.valueOf(1)));
auth.setInvalid(false); auth.setInvalid(false);
auth.setUpdateDate(new Date()); // auth.setUpdateDate(new Date());
EmailAuth ret = emailAuthDAO.create(auth); EmailAuth ret = emailAuthDAO.create(auth);
System.out.println(ret.getId()); 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());
}
} }

View File

@ -7,13 +7,14 @@
<class>com.loafle.overflow.noauthagent.model.NoAuthAgent</class> <class>com.loafle.overflow.noauthagent.model.NoAuthAgent</class>
<class>com.loafle.overflow.apikey.model.Apikey</class> <class>com.loafle.overflow.apikey.model.Apikey</class>
<class>com.loafle.overflow.agent.model.Agent</class> <class>com.loafle.overflow.agent.model.Agent</class>
<class>com.loafle.overflow.email.model.EmailAuth</class>
<properties> <properties>
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://192.168.1.106:5432/postgres" /> <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://192.168.1.106:5432/postgres" />
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" /> <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
<property name="javax.persistence.jdbc.user" value="vertx" /> <property name="javax.persistence.jdbc.user" value="vertx" />
<property name="javax.persistence.jdbc.password" value="qwe123" /> <property name="javax.persistence.jdbc.password" value="qwe123" />
<!--<property name="hibernate.hbm2ddl.auto" value="create-drop"/>--> <!--<property name="hibernate.hbm2ddl.auto" value="create-drop"/>-->
<property name="hibernate.hbm2ddl.auto" value="create"/> <!--<property name="hibernate.hbm2ddl.auto" value="create"/>-->
<property name="hibernate.show_sql" value="true" /> <property name="hibernate.show_sql" value="true" />
</properties> </properties>
</persistence-unit> </persistence-unit>