Last active
May 20, 2021 00:48
-
-
Save dsdstudio/bfe66037d39073f489dc8bfc5467fdfe to your computer and use it in GitHub Desktop.
jooq schema ddl jpa entity로 부터 뽑아내기
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
maven { | |
url 'https://plugins.gradle.org/m2/' | |
} | |
} | |
dependencies { | |
classpath("nu.studer:gradle-jooq-plugin:3.0.3") | |
} | |
} | |
apply plugin: 'nu.studer.jooq' | |
dependencies { | |
jooqRuntime 'org.jooq:jooq:3.11.11' | |
jooqRuntime 'org.jooq:jooq-meta-extensions:3.11.11' | |
jooqRuntime(files(sourceSets.main.output.classesDirs)) | |
} | |
jooq { | |
version = '3.11.11' | |
edition = 'OSS' | |
project(sourceSets.main) { | |
generator { | |
strategy { | |
name = "com.mycompany.JQPrefixGeneratorStrategy" | |
} | |
database { | |
name = 'org.jooq.meta.extensions.jpa.JPADatabase' | |
properties { | |
property { | |
key = "packages" | |
value = "com.mycompany.model" | |
} | |
} | |
includes = ".*" | |
} | |
target { | |
packageName = 'org.jooq' | |
directory = 'src/main/generated' | |
encoding = 'UTF-8' | |
} | |
} | |
} | |
} | |
project.tasks.getByName('compileJava').dependsOn -= 'generateProjectJooqSchemaSource' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jooq.codegen.DefaultGeneratorStrategy; | |
import org.jooq.meta.Definition; | |
public class JQPrefixGeneratorStrategy extends DefaultGeneratorStrategy { | |
@Override | |
public String getJavaClassName(Definition definition, Mode mode) { | |
return "JQ" + super.getJavaClassName(definition, mode); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment