728x90
1. table 구조
create table user(
userIdx int not null AUTO_INCREMENT,
name varchar(10) not null,
email varchar(50) not null,
pw varchar(50) not null,
pwCheck varchar(50) not null,
tel int not null,
address varchar(500) not null,
checkAll boolean not null,
PRIMARY KEY (userIdx)
);
2. 사용법
- repository
@Insert("INSERT INTO dbelle.user (name, email, pw, pwCheck, tel, address, checkAll) VALUES (#{name}, #{email}, #{pw}, #{pwCheck}, #{tel}, #{address} , #{checkAll})")
@Options(useGeneratedKeys = true, keyProperty = "userIdx")
void addUserinfo(User user);
- xml
<insert id="addUserinfo" parameterType="com.dbellart.web.domain.User" useGeneratedKeys="true" keyProperty="userIdx">
<![CDATA[
insert into dbelle.USER (userIdx, name, email, pw, pwCheck, tel, address, checkAll)
values (#{name}, #{email}, #{pw}, #{pwCheck}, #{tel}, #{address} , #{checkAll})
]]>
</insert>
728x90
'DB' 카테고리의 다른 글
[DataBase] 각 DataBase 각각 컬럼별 연결 (0) | 2023.07.12 |
---|---|
[JPA DataBase] JPA를 이용하여 테이블 만들기 (application.yml) (0) | 2023.07.11 |
[DataBase] appliction.yml database 설정 방법 (0) | 2023.07.11 |
[DataBase] @annotation, Lombok 어노테이션의 모든 것 (0) | 2023.07.11 |
[DataBase 관련] BaseTimeEntity (0) | 2023.07.11 |