스프링 설정파일에서 xml을 다음과 같이설정한다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14 |
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jd="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd">
<jdbc:embedded-database id="dataSourceSpied" type="HSQL" />
<jdbc:initialize-database data-source="dataSourceSpied" ignore-failures="DROPS">
<jdbc:script location="classpath:database/hsqldb/schema.sql" />
<jdbc:script location="classpath:database/hsqldb/data.sql" />
</jdbc:initialize-database> |
cs |
schema.sql
1
2
3
4
5
6
7 |
create table t_sample (
sample_no int not null,
title varchar(500) not null,
description varchar(1000) not null,
primary key (sample_no)
);
|
cs |
data.sql
1
2
3
4 |
insert into t_sample (sample_no, title, description) values (1, '타이틀 1', '설명 1');
insert into t_sample (sample_no, title, description) values (2, '타이틀 2', '설명 2');
insert into t_sample (sample_no, title, description) values (3, '타이틀 3', '설명 3');
commit; |
cs |
'FrameWork' 카테고리의 다른 글
스트럿츠(Struts) 소개 (0) | 2018.10.20 |
---|---|
MVC 디자인 패턴 (0) | 2018.10.20 |
DTO 란? (0) | 2015.12.10 |
프레임워크(Framework)와 라이브러리 (0) | 2015.12.10 |
Spring 이란 ? (0) | 2015.12.10 |