๋ฐ˜์‘ํ˜•
์ƒํ™ฉ

H2 db ์‚ฌ์šฉ, entity class ์— ํ…Œ์ด๋ธ”๋ช…์„ ๋ช…์‹œํ•ด์ฃผ์ง€ ์•Š์Œ. 
๋ฐ์ดํ„ฐ ๋“ฑ๋ก ์ฒ˜๋ฆฌ ์ค‘ ํ•ด๋‹น ์—๋Ÿฌ ๋ฐœ์ƒ (ํ…Œ์ด๋ธ” ์‹œํ€€์Šค ๊ฐ’์ด ์—†๋‹ค๋Š” ์ƒํ™ฉ)

 

ํ•ด๊ฒฐ

entity class (@Entity ์„ค์ • ํด๋ž˜์Šค) ๋‚ด id ํ•„๋“œ(@Id ์„ค์ •๋œ ๊ฐ’)์˜
@GeneratedValue(strategy = GenerationType.AUTO) ์„ค์ • ๋ถ€๋ถ„์„
@GeneratedValue(strategy = GenerationType.IDENTITY) ์œผ๋กœ ๋ณ€๊ฒฝ
    --> ๊ธฐ๋ณธํ‚ค ์ƒ์„ฑ์„ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ์œ„์ž„ํ•ด์ฃผ๊ณ  id๊ฐ€ null ์ด๋ฉด ์•Œ์•„์„œ auto_increment ํ•ด์คŒ


์ฐธ๊ณ 

https://stackoverflow.com/questions/39807483/sequence-hibernate-sequence-not-found-sql-statement

 

Sequence "HIBERNATE_SEQUENCE" not found; SQL statement

In my spring mvc app, i have the following object. I am trying to make a visual of data using devtool in my app. @Entity @Data public class ConsultationRequest { @Id @GeneratedValue p...

stackoverflow.com

https://gmlwjd9405.github.io/2019/08/12/primary-key-mapping.html

๋ฐ˜์‘ํ˜•

+ Recent posts