前提
- SpringBootでJPAを使用してテーブルを自動生成しています。
yml
1 jpa: 2 database-platform: org.hibernate.dialect.PostgreSQLDialect 3 hibernate: 4 ddl-auto: update
@EntityScan
の設定はしており、他のテーブルは自動生成されるのですが、一部パッケージ配下のテーブルが自動生成されません。
該当のソースコード
java
1package example; 2 3import javax.persistence.Column; 4import javax.persistence.Entity; 5import javax.persistence.Id; 6import javax.persistence.Table; 7 8import lombok.Data; 9 10@Entity 11@Table(name = "m_role") 12@Data 13public class MRole { 14 @Id 15 @Column 16 String roleId; 17 @Column 18 String roleName; 19} 20
試したこと
別のパッケージのクラスに対応するテーブルは自動生成されます。
java
1package example; 2 3import javax.persistence.Column; 4import javax.persistence.Entity; 5import javax.persistence.Id; 6import javax.persistence.Table; 7 8import lombok.Data; 9 10@Entity 11@Table(name = "m_project") 12@Data 13public class MProject { 14 @Id 15 @Column 16 String projectId; 17 @Column 18 String projectName; 19}
補足情報(FW/ツールのバージョンなど)
- SpringBoot 2.4.0
- PostgreSQL 14
build.gradle(抜粋)
gradle
1dependencies { 2 implementation 'org.springframework.boot:spring-boot-starter-actuator' 3 implementation 'org.springframework.boot:spring-boot-starter-batch' 4 implementation 'org.springframework.boot:spring-boot-starter-cache' 5 implementation 'org.springframework.boot:spring-boot-starter-groovy-templates' 6 implementation 'org.springframework.boot:spring-boot-starter-jdbc' 7 implementation 'org.springframework.boot:spring-boot-starter-mail' 8 implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' 9 implementation 'org.springframework.boot:spring-boot-starter-quartz' 10 implementation 'org.springframework.boot:spring-boot-starter-security' 11 implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' 12 implementation 'org.springframework.boot:spring-boot-starter-web' 13 implementation 'org.springframework.session:spring-session-jdbc' 14 implementation 'com.h2database:h2' 15 implementation 'com.google.code.gson:gson' 16 implementation 'org.springframework.boot:spring-boot-starter-data-jpa' 17 implementation 'org.apache.commons:commons-lang3' 18 implementation 'com.google.guava:guava:30.1-jre' 19 implementation 'org.apache.poi:poi:4.1.2' 20 implementation('org.apache.poi:poi-ooxml:4.1.2') { 21 exclude group: 'stax', module: 'stax-api' 22 } 23 implementation 'commons-io:commons-io:2.8.0' 24 implementation 'org.freemarker:freemarker:2.3.30' 25 implementation 'com.vladmihalcea:hibernate-types-55:2.14.0' 26 implementation 'javax.validation:validation-api:2.0.1.Final' 27 implementation 'com.codeborne:selenide:5.17.2' 28 implementation 'commons-beanutils:commons-beanutils:1.9.4' 29 implementation 'net.sf.dozer:dozer:5.5.1' 30 annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' 31 annotationProcessor 'org.projectlombok:lombok' 32 providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat' 33 testImplementation('org.springframework.boot:spring-boot-starter-test') { 34 exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' 35 } 36 testImplementation 'io.projectreactor:reactor-test' 37 testImplementation 'org.springframework.batch:spring-batch-test' 38 testImplementation 'org.springframework.security:spring-security-test' 39 developmentOnly 'org.springframework.boot:spring-boot-devtools' 40 runtimeOnly 'mysql:mysql-connector-java' 41 runtimeOnly 'org.hibernate.validator:hibernate-validator:6.0.17.Final' 42 runtimeOnly 'org.glassfish:javax.el:3.0.1-b11' 43 runtimeOnly 'org.postgresql:postgresql' 44}
問題の勘所等ご教示頂きたく、何卒よろしくお願い致します。
あなたの回答
tips
プレビュー