Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Cisco
- ciscopacket
- jsp연결
- 네트워크관리사
- 라우터
- sql
- 리눅스
- php
- html
- 이것이 자바다
- ospf
- NCS
- cisco packet
- 원형그래프
- 자바
- 정처기필기
- javaee
- Oracle
- 참조타입
- jsp
- VLAN
- 데이터베이스
- w3school
- 오라클
- 정보처리기사
- 네트워크
- rinux
- 버추얼머신
- autoset
- Java
Archives
- Today
- Total
기록해! 정리해!
ajax + jQuery + 댓글 본문
[기본 테이블]
create table student(
sno varchar2(3) ,
sname nvarchar2(10),
year varchar2(10),
dept nvarchar2(10) ,
constraint student_sno_pk primary key(sno));
[댓글에 필요한 테이블]
Create table student_reply(
idx number(3) not null primary key, -- 테이블에 P.K 만들기
sno varchar2(3) not null, -- Student 테이블과 외래키로 연결할 컬럼 만들기
reply nvarchar2(500) not null, -- 댓글 내용 저장 ( 상담내용 )
replayer nvarchar2(10) not null, -- 댓글 작성자
replyDate date default sysdate -- 댓글 작성일
) ;
create sequence seq_replay;
-- student 테이블의 sno 와 외래키로 연결하기
alter table student_reply add constraint fk_student_reply
foreign key(sno) references student(sno);
[샘플 레코드 추가]
insert into student_reply ( idx, sno, reply, replayer )
values (seq_replay.nextval, '100', '첫번째 성적 상담 입니다.','담임선생님' );
insert into student_reply ( idx, sno, reply, replayer )
values (seq_replay.nextval, '100', '두번째 친구 상담','상담선생님' );
insert into student_reply ( idx, sno, reply, replayer )
values (seq_replay.nextval, '200', '진로 상담.','담임선생님' );
insert into student_reply ( idx, sno, reply, replayer )
values (seq_replay.nextval, '300', '취업 상담 입니다.','담임선생님' );
select * from student_reply;
1.
2. 매핑
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="REPLY">
<select id="getBoradList" parameterType="psdBoard" resultType="psdBoard" >
select idx, sno, reply, replyer, replyDate
from student_reply where sno=#{sno}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC
"-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<typeAliases>
<typeAlias alias="exam" type="com.springbook.biz.examtbl.ExamtblVo" />
<typeAlias alias="student" type="com.springbook.biz.university.StudentVo" />
<typeAlias alias="course" type="com.springbook.biz.university.CourseVo" />
<typeAlias alias="enrol" type="com.springbook.biz.university.EnrolVo" />
<typeAlias alias="sejoin" type="com.springbook.biz.university.SEJoinVo" />
<typeAlias alias="secjoin" type="com.springbook.biz.university.SECJoinVo" />
<typeAlias alias="courseGroup" type="com.springbook.biz.university.CourseGroupVo" />
<typeAlias alias="psdBoard" type="com.springbook.biz.psdBoard.BoardPsdVo" />
<typeAlias alias="bigdata" type="com.springbook.biz.bigdata.BigdataVo" />
<typeAlias alias="company" type="com.springbook.biz.company.CompanyVo" />
<typeAlias alias="reply" type="com.springbook.biz.reply.ReplyVo" />
</typeAliases>
<mappers>
<mapper resource="mappings/examtbl-mapping.xml" />
<mapper resource="mappings/university-mapping.xml" />
<mapper resource="mappings/psdBoard-mapping.xml" />
<mapper resource="mappings/bigdata-mapping.xml" />
<mapper resource="mappings/company-mapping.xml" />
<mapper resource="mappings/reply-mapping.xml" />
</mappers>
</configuration>
* index에서 에러날 경우)
Maven 추가
'Spring' 카테고리의 다른 글
Setter 사용하기 (1) (0) | 2022.09.20 |
---|---|
Spring - 서블릿 클래스 확인 (0) | 2022.09.20 |
MyBatis (0) | 2022.09.08 |
Spring - lombok (0) | 2022.08.26 |
Spring - TV (0) | 2022.08.25 |
Comments