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
- boolean배열
- (참고로 boolean 배열의 default 값은 false 이다.
- ㅓㅂ
- 그럼 int배열의 deefault값은?????
- 행열. 2중반복문..
- 마지막에 배열의 foreach구문이 틀린것같은데 ...... 저게왜틀린건지나는잘모르겠슴다.
- 출처:구멍가게코딩단-코배스(개정판)
- bindingresult 쓰니까 에러났다. 어떻게해야하냐;;
- 생활코딩
- form.getImageFies 오타났음
- while문이 틀린이유?? math.random()을 사용해서푸는법?
Archives
- Today
- Total
푸린세스
p190 MySQL~Oracle 본문
selectKey 부분은 MySQL로는 어떻게 하나요??
MySQL이 시퀀스가 없어서 어떻게 해야되는지 잘 모르겠습니다
A:
selectkey 의 before가 아니라 after를 이용하고 select last_insert_id( ) 를 이용하면 됩니다.
<insert id="insert">
insert into tbl_board (title,content,writer)
values(#{title},#{content},#{writer})
<selectKey order="AFTER" resultType="long" keyProperty="bno">
select last_insert_id()
</selectKey>
</insert>
<insert id = "insertSelectKey">
<selectKey keyProperty="bno" order = "BEFORE" resultType = "long">
select max(bno)+1 from tbl_board;
</selectKey>
insert into tbl_board (bno, title, content, writer)
values (#{bno}, #{title}, #{content}, #{writer})
</insert>
저는 이렇게 해봤는데
적어주신 방법이랑 어떤 차이가 있을까요??
출처- 구멍가게코딩단 네이버카페
'spring > 구멍가게코딩단-스프링' 카테고리의 다른 글
rownum과 index (0) | 2023.05.06 |
---|---|
MySQL ~ log4jdbc 설정하기. (0) | 2023.05.03 |
스프링MVC의 기본사상 (0) | 2023.05.02 |
스프링MVC 기본구조 (0) | 2023.05.02 |
MyBatis ~ 스프링과 연동처리 (0) | 2023.05.01 |