Query 뽑을때는 게시판용 List 부터....SQL뽑는데 Story Board가 지대한 영향.
DB에서 테이블 작성 -> data insert 한 후 제대로 되는지 확인 -> 확인된 SQL문을 DAO에 구현 ->Test의 순서가 반복.
CRUD(등록, 조회, 수정, 삭제)
이제부터 패키지가 나뉨. 맡은 역할 별로.
VO(Value Object) 클래스 : DB에서 데이터를 읽어 저장하는 클래스.
VO 패키지에는 VO 클래스만 넣어둠.
package org.soju.vo;
import java.util.Date;
/**
*
sno number,
sname varchar2(500) not null, --null이 들어가면 인덱스 못줌
addr varchar2(500),
keyword varchar2(500) not null,
tel varchar2(20),
sdesc varchar2(1000) not null,
regdate date default sysdate
viewcnt
* @author BIT
*
*/
public class StoreVO {
private Integer sno;
private String sname;
private String addr;
private String keyword;
private String tel;
private String sdesc;
private Date regdate;
private int viewcnt;
public Integer getSno() {
return sno;
}
public void setSno(Integer sno) {
this.sno = sno;
}
public String getSname() {
return sname;
}
public void setSname(String sname) {
this.sname = sname;
}
public String getAddr() {
return addr;
}
public void setAddr(String addr) {
this.addr = addr;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public String getSdesc() {
return sdesc;
}
public void setSdesc(String sdesc) {
this.sdesc = sdesc;
}
public Date getRegdate() {
return regdate;
}
public void setRegdate(Date regdate) {
this.regdate = regdate;
}
public int getViewcnt() {
return viewcnt;
}
public void setViewcnt(int viewcnt) {
this.viewcnt = viewcnt;
}
@Override
public String toString() {
return "StoreVo [sno=" + sno + ", sname=" + sname + ", addr=" + addr
+ ", keyword=" + keyword + ", tel=" + tel + ", sdesc=" + sdesc
+ ", regdate=" + regdate + ", viewcnt=" + viewcnt + "]";
}
}
======================================================================================
package org.soju.vo;
import java.sql.Date;
/*
*
user_id varchar2(100) constraint pk_user primary key,
uname varchar2(100) not null,
pw varchar2(100) not null,
birth date not null,
gender varchar2(1) default 'M',
regdate date default sysdate
*/
public class UserVO {
private String user_id;
private String uname;
private String pw;
private Date birth;
private String gender;
private Date regdate;
public String getUser_id() {
return user_id;
}
public void setUser_id(String user_id) {
this.user_id = user_id;
}
public String getUname() {
return uname;
}
public void setUname(String uname) {
this.uname = uname;
}
public String getPw() {
return pw;
}
public void setPw(String pw) {
this.pw = pw;
}
public Date getBirth() {
return birth;
}
public void setBirth(Date birth) {
this.birth = birth;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public Date getRegdate() {
return regdate;
}
public void setRegdate(Date regdate) {
this.regdate = regdate;
}
@Override
public String toString() {
return "UserVO [user_id=" + user_id + ", uname=" + uname + ", pw=" + pw
+ ", birth=" + birth + ", gender=" + gender + ", regdate="
+ regdate + "]";
}
}
'코딩 > Oracle' 카테고리의 다른 글
JDBC설계 Step1 - (3) org.soju.foodstore.dao, Java enum 예제 (0) | 2014.09.17 |
---|---|
JDBC설계 Step1 - (2) org.soju.foodstore.util; (0) | 2014.09.17 |
(3) JDBC 간단한 Query 예제 - Junit을 통한 test (0) | 2014.09.16 |
(2) JDBC 간단한 Query 예제 - Singleton + Template Method (0) | 2014.09.15 |
(1) JDBC 간단한 Query 예제 - Singleton Pattern (0) | 2014.09.15 |