결론부터 말하자면
1. 간단히 애노테이션이나 설정값 변경으로 할 수는 없다.
2. 또한, Hibernate에서도 장려하지 않는다.
간단히 할 수 없다고 한 것은,
Hibernate의 DDL 생성 부분을 깊이 있게 파서 어떻게 해결할 수는 있을 것이라는 뜻이다.
참고:
www.inflearn.com/questions/17359
hbm2ddl 를 이용해 테이블 생성시 컬럼 순서 수정 방법 - 인프런 | 질문 & 답변
안녕하세요. Kyeongseok Ko님^^ 사실 저도 처음 JPA를 사용할 때 이것 때문에 고민을 좀 했었는데요. 아쉽지만 현재로써는 단순하게 해결할 수 있는 방법은 없습니다. 하이버네이트의 DDL 생성 부분을
www.inflearn.com
Hibernate에서도 장려하지 않는다는 것은,
hbm2ddl이 제공하는 ddl은 개발 단계에서는 편리하지만 프로덕션 단계에서는 한계가 있다는 뜻이다.
spring.jpa.hibernate.ddl-auto 옵션을 update로 설정하면 컬럼을 추가할 수는 있으나 제거할 수는 없는 것이 그 예시 중 하나이다.
참고:
stackoverflow.com/questions/1298322/wrong-ordering-in-generated-table-in-jpa
Wrong ordering in generated table in jpa
This (should) be a rather simple thing to do, however I am struggling. I want a table to be generated like this: id organizationNumber name However, when I look in the database, I see that the
stackoverflow.com
stackoverflow.com/questions/12433998/hibernate-reversed-column-order-by-hbm2ddl?noredirect=1&lq=1
Hibernate: Reversed column order by hbm2ddl
I let hbm2ddl create the tables for me (for dev purposes), and the columns are in reverse order of the fields in the class. How can I make it create the columns in the same order as the class has?...
stackoverflow.com
'웹 개발 > Spring' 카테고리의 다른 글
[Spring] Spring Rest Docs (0) | 2022.03.27 |
---|---|
[Spring] JPA - How to fix “Error executing DDL ”alter table events drop foreign key {foreign key} “ via JDBC Statement” (0) | 2021.03.12 |
[Spring] JPA - @OneToOne 조인 전략을 left join -> inner join 으로 변경하기 (0) | 2021.03.12 |
[Spring] JPA - Could not write JSON: Infinite recursion (StackOverflowError) (0) | 2021.03.11 |
[Spring] Spring REST Docs 호스트 변경 (0) | 2021.03.04 |