https://www.jooq.org/doc/latest/manual/code-generation/codegen-jpa/
I want to generate from JPA Entites
but I saw something like this
This can have several reasons, including:
- The packages you've listed do not exist (com.example.member.member)
- The entities in the listed packages are not on the JPADatabase classpath (you must compile them before running jOOQ's codegen, see "how to organise your dependencies" in the manual: https://www.jooq.org/doc/latest/manual/code-generation/codegen-jpa/!)
this is my gradle.build
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
/* See above for the correct groupId */
classpath 'org.jooq:jooq-codegen:3.18.5'
classpath 'com.h2database:h2:2.1.214'
classpath 'org.jooq:jooq-meta-extensions-hibernate:3.18.5'
}
}
plugins {
id 'java'
id 'org.springframework.boot' version '3.0.6'
id 'io.spring.dependency-management' version '1.1.0'
}
import org.jooq.codegen.GenerationTool
import org.jooq.meta.jaxb.*
task generateCode() {
GenerationTool.generate(new org.jooq.meta.jaxb.Configuration()
.withGenerator(new Generator()
.withDatabase(new Database()
.withName("org.jooq.meta.extensions.jpa.JPADatabase")
// .withIncludes(".*")
.withProperties(
// A comma separated list of Java packages, that contain your entities
new Property()
.withKey("packages")
.withValue("com.example.member.member"),
// Whether JPA 2.1 AttributeConverters should be auto-mapped to jOOQ Converters.
// Custom <forcedType/> configurations will have a higher priority than these auto-mapped converters.
// This defaults to true.
new Property()
.withKey("useAttributeConverters")
.withValue("true"),
// The default schema for unqualified objects:
//
// - public: all unqualified objects are located in the PUBLIC (upper case) schema
// - none: all unqualified objects are located in the default schema (default)
//
// This configuration can be overridden with the schema mapping feature
new Property()
.withKey("unqualifiedSchema")
.withValue("none")
)
)
.withTarget(new Target()
.withPackageName(projectDir.toString() + "jooq.generated.example")
.withDirectory("src/main/java")
)))
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation group: 'org.jooq', name: 'jooq', version: '3.18.5'
// implementation group: 'org.jooq', name: 'jooq-meta-extensions-hibernate', version: '3.18.5'
runtimeOnly "io.netty:netty-resolver-dns-native-macos:4.1.76.Final:osx-aarch_64"
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
tasks.named('test') {
useJUnitPlatform()
}
I don't know what to do