This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.
ScalaGenerator and Scala3Generator
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
jOOQ can generate Scala code instead of Java code, which allows for leveraging a few Scala language features also in generated code.
In order to use the ScalaGenerator
(or Scala3Generator
), simply place the following class reference into your code generation configuration:
<configuration> <generator> <!-- For legacy Scala 2.x support, use org.jooq.codegen.ScalaGenerator --> <name>org.jooq.codegen.Scala3Generator</name> </generator> </configuration>
See the configuration XSD, standalone code generation, and maven code generation for more details.
new org.jooq.meta.jaxb.Configuration() .withGenerator(new Generator() // For legacy Scala 2.x support, use org.jooq.codegen.ScalaGenerator .withName("org.jooq.codegen.Scala3Generator") )
See the configuration XSD and programmatic code generation for more details.
import org.jooq.meta.jaxb.* configuration { generator { // For legacy Scala 2.x support, use org.jooq.codegen.ScalaGenerator name = "org.jooq.codegen.Scala3Generator" } }
See the configuration XSD and gradle code generation for more details.
configuration { generator { // For legacy Scala 2.x support, use org.jooq.codegen.ScalaGenerator name = "org.jooq.codegen.Scala3Generator" } }
See the configuration XSD and gradle code generation for more details.
generationTool { generator { // For legacy Scala 2.x support, use org.jooq.codegen.ScalaGenerator name = "org.jooq.codegen.Scala3Generator" } }
See the configuration XSD and gradle code generation for more details.
Most of the code generation configuration remains the same for as long as it's independent of the generation language. But there are a few Scala specific configuration flags, which are documented below:
<configuration> <generator> <generate> <!-- Generate POJOs as case classes, when using the ScalaGenerator. Default is true. --> <pojosAsScalaCaseClasses>true</pojosAsScalaCaseClasses> </generate> </generator> </configuration>
See the configuration XSD, standalone code generation, and maven code generation for more details.
new org.jooq.meta.jaxb.Configuration() .withGenerator( new Generate() // Generate POJOs as case classes, when using the ScalaGenerator. Default is true. .withPojosAsScalaCaseClasses(true) )
See the configuration XSD and programmatic code generation for more details.
import org.jooq.meta.jaxb.* configuration { generator { generate { // Generate POJOs as case classes, when using the ScalaGenerator. Default is true. isPojosAsScalaCaseClasses = true } } }
See the configuration XSD and gradle code generation for more details.
configuration { generator { generate { // Generate POJOs as case classes, when using the ScalaGenerator. Default is true. pojosAsScalaCaseClasses = true } } }
See the configuration XSD and gradle code generation for more details.
generationTool { generator { generate { // Generate POJOs as case classes, when using the ScalaGenerator. Default is true. pojosAsScalaCaseClasses = true } } }
See the configuration XSD and gradle code generation for more details.
Feedback
Do you have any feedback about this page? We'd love to hear it!