Hibernate

JPA + Hibernate์—์„œ DDL script ํŒŒ์ผ๋กœ ์ €์žฅํ•˜๊ธฐ

JoonHo Son
JPA๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ๋ถ€ํ„ฐ ๊ณ„์† ํ•˜๋ ค๊ณ  ํ–ˆ๋˜๊ฑด๋ฐ, ์ด๋ฒˆ์— ์†Œ๊ธฐ์˜ ๋ชฉ์ ์—์„œ ์•„์ฃผ ์ผ๋ถ€๋ถ„์€ ๋‹ฌ์„ฑํ•˜์—ฌ ์ง„ํ–‰ํ–ˆ๋˜ ๊ณผ์ •์„ ๊ธฐ๋ก์ฐจ์›์—์„œ ๋‚จ๊ธด๋‹ค. ์„ ์š”์•ฝ ์ง€์ •ํ•œ ํŒจํ‚ค์ง€์˜ @Entity annotation์ด ์„ ์–ธ๋œ ํด๋ž˜์Šค๋ฅผ ๊ฒ€์ƒ‰ํ•˜์—ฌ DDL script๋ฅผ ํŒŒ์ผ๋กœ ์ƒ์„ฑํ•œ๋‹ค. DDL script ์ƒ์„ฑ์‹œ column comment๋„ ํ•จ๊ป˜ ์ƒ์„ฑํ•œ๋‹ค(์ œ์ผ ๊ณ ๋ฏผ์„ ๋งŽ์ด ํ•จ). @Embedded annotation์ด ๋‹ฌ๋ฆฐ ํ•ญ๋ชฉ๋„ comment๋ฅผ ์ƒ์„ฑํ•œ๋‹ค. TODO Table comment ์ถ”๊ฐ€ Embedded ์ˆœํ™˜ ์ฒ˜๋ฆฌ ๊ตฌํ˜„๋ถ€ ์ž‘์—…์˜ ํ๋ฆ„ ์šฐ์„  Reflections์„ ์ด์šฉํ•˜์—ฌ ์ง€์ •ํ•œ package์•ˆ์— ์กด์žฌํ•˜๋Š” ํด๋ž˜์Šค ์ค‘ @Entity annotation์ด ์„ ์–ธ๋œ ํด๋ž˜์Šค๋ฅผ ๊ฒ€์ƒ‰ํ•œ๋‹ค.