인프런 커뮤니티 질문&답변
상품등록 에러
작성
·
184
0
안녕하세요 항상 수업 열심히 듣고 있습니다! 상품등록 구현에 대해서 여쭤볼 것이 있는데요.
상품등록 컨트롤러를 작성하고 상품 정보 입력 후 submit 버튼을 누르면 다음과 같은 페이지로 이동합니다. DB를 보니 첫번째 저장 상품만 들어가있고 그 뒤에 상품들은 들어가있지 않습니다.
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Sat Mar 14 00:40:31 KST 2020
There was an unexpected error (type=Internal Server Error, status=500).
could not execute statement; SQL [n/a]; constraint ["PRIMARY KEY ON PUBLIC.ITEM(ITEM_ID) ['B', 1, STRINGDECODE('\ub77c\uc774\uc5b8'), 10000, 2, STRINGDECODE('\uce74\uce74\uc624'), '111222333', NULL, NULL, NULL, NULL]"; SQL statement: insert into item (name, prices, stock_quantity, author, isbn, dtype, item_id) values (?, ?, ?, ?, ?, 'B', ?) [23505-200]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
계속 찾아봐도 무엇 때문에 오류가 난 것인지 모르겠어서요ㅠㅠ 답변 기다리겠습니다. 감사합니다!
+)
오늘 회원가입 기능을 다시해보니 회원가입도 이 에러 페이지로 넘어갑니다. SQL문이 처리가 안되는 것 같습니다.
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Sat Mar 14 19:07:34 KST 2020
There was an unexpected error (type=Internal Server Error, status=500).
could not execute statement; SQL [n/a]; constraint ["PRIMARY KEY ON PUBLIC.MEMBER(MEMBER_ID) [1, STRINGDECODE('\uc11c\uc6b8'), STRINGDECODE('\uc2b9\ubc29\ub098\uae38'), '12345', STRINGDECODE('\uc774\uc9c4\uc8fc')]"; SQL statement: insert into member (city, street, zipcode, name, member_id) values (?, ?, ?, ?, ?) [23505-200]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
답변 3
1
0
0
김영한
지식공유자
안녕하세요. 이진주님
먼저 질문을 몇가지 드릴께요.
먼저 로컬에 다운로드 받아서 설치한 H2 데이터베이스 버전을 확인해주세요. 만약에 1.4.200 버전이라면, 삭제하고, 1.4.199 버전으로 다시 다운로드 받아서 실행해주세요^^!
(전체 다운로드 링크: https://www.h2database.com/html/download.html)
1.4.199 버전 다운로드 링크
윈도우 설치 버전: https://h2database.com/h2-setup-2019-03-13.exe
윈도우, 맥, 리눅스 실행 버전: https://h2database.com/h2-2019-03-13.zip
만약 이렇게 진행해서 안되면 다시 말씀해주세요 :)





