In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-action=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --action=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The action
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
action.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
action = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The action
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<action>configValue</action>
</names>
</configuration>
</plugin>
</plugins>
</build>
The default value of the allowedCallPrefixes
configuration option is call, execute, evaluate, eval
to allow several commonly used names for calling procedures.
Changing the allowedCallPrefixes
configuration option to do
only allows names with the prefix do
to call stored procedures.
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-allowed-call-prefixes=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --allowed-call-prefixes=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The allowedCallPrefixes
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
allowedCallPrefixes.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
allowedCallPrefixes = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The allowedCallPrefixes
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<allowedCallPrefixes>configValue</allowedCallPrefixes>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
The default value of the allowedReadPrefixes
configuration option is read, select, find, query, lookup, get
to allow several commonly used names for reading statements.
Changing the allowedReadPrefixes
configuration option to lego
only allows names with the prefix lego
to read data.
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-allowed-read-prefixes=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --allowed-read-prefixes=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The allowedReadPrefixes
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
allowedReadPrefixes.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
allowedReadPrefixes = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The allowedReadPrefixes
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<allowedReadPrefixes>configValue</allowedReadPrefixes>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
The default value of the allowedWritePrefixes
configuration option is update, insert, delete, create, write, add, remove, merge, drop
to allow several commonly used names for writing statements.
Changing the allowedWritePrefixes
configuration option to scribo
only allows names with the prefix scribo
to write data.
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-allowed-write-prefixes=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --allowed-write-prefixes=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The allowedWritePrefixes
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
allowedWritePrefixes.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
allowedWritePrefixes = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The allowedWritePrefixes
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<allowedWritePrefixes>configValue</allowedWritePrefixes>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
The default value of the annotateClasses
configuration option is false
. Setting the option to false
therefore produces the same code generated as the default configuration.
package com.example.persistence;
public class SomeRepository {
// ... rest of generated code
}
Changing the annotateClasses
configuration option to true
adds the @Generated
annotation to every generated classes. Its is possible to configure each value individually using other config options.
package com.example.persistence;
import javax.annotation.processing.Generated;
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
public class SomeRepository {
// ... rest of generated code (same as above)
}
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --annotations-annotate-classes=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --annotate-classes=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The annotateClasses
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
annotations {
annotateClasses.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
annotations {
annotateClasses = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The annotateClasses
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<annotations>
<annotateClasses>configValue</annotateClasses>
</annotations>
</configuration>
</plugin>
</plugins>
</build>
The default value of the annotateFields
configuration option is false
. Setting the option to false
therefore produces the same code generated as the default configuration.
package com.example.persistence;
public class SomeRepository {
private Object someField;
// ... rest of generated code
}
Changing the annotateFields
configuration option to true
adds the @Generated
annotation to every generated fields. Its is possible to configure each value individually using other config options.
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
private Object someField;
// ... rest of generated code (same as above)
}
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --annotations-annotate-fields=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --annotate-fields=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The annotateFields
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
annotations {
annotateFields.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
annotations {
annotateFields = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The annotateFields
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<annotations>
<annotateFields>configValue</annotateFields>
</annotations>
</configuration>
</plugin>
</plugins>
</build>
The default value of the annotateMethods
configuration option is false
. Setting the option to false
therefore produces the same code generated as the default configuration.
package com.example.persistence;
public class SomeRepository {
public void someMethod() {
// ... some code
}
// ... rest of generated code
}
Changing the annotateMethods
configuration option to true
adds the @Generated
annotation to every generated methods. Its is possible to configure each value individually using other config options.
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
public void someMethod() {
// ... some code
}
// ... rest of generated code (same as above)
}
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --annotations-annotate-methods=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --annotate-methods=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The annotateMethods
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
annotations {
annotateMethods.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
annotations {
annotateMethods = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The annotateMethods
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<annotations>
<annotateMethods>configValue</annotateMethods>
</annotations>
</configuration>
</plugin>
</plugins>
</build>
The default value of the annotationApi
configuration option is PROCESSING_API
. Setting the option to PROCESSING_API
therefore produces the same code generated as the default configuration.
package com.example.persistence;
import javax.annotation.processing.Generated;
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
public class SomeRepository {
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
private Object someField;
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
public void someMethod() {
// ... some code
}
// ... rest of generated code
}
Changing the annotationApi
configuration option to ANNOTATION_API
uses the annotation API instead.
package com.example.persistence;
import javax.annotation.Generated;
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
public class SomeRepository {
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
private Object someField;
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
public void someMethod() {
// ... some code
}
// ... rest of generated code (same as above)
}
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --annotations-annotation-api=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --annotation-api=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The annotationApi
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
annotations {
annotationApi.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
annotations {
annotationApi = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The annotationApi
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<annotations>
<annotationApi>configValue</annotationApi>
</annotations>
</configuration>
</plugin>
</plugins>
</build>
This list is empty by default and thus no annotations are added to generated methods.
In order to add an annotation to the generated methods, specify its fully-qualified name.
package com.example.persistence;
import your.own.Annotation;
public class SomeRepository {
@Annotation
public void someMethod() {
// ... some code
}
// ... rest of generated code
}
In order to add an annotation with some member, specify name of the annotation member, its value, and its type. The type defaults to java.lang.String
.
package com.example.persistence;
import your.other.Annotation;
public class SomeRepository {
@Annotation(member = "value")
public void someMethod() {
// ... some code
}
// ... rest of generated code
}
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to configure this option, place the following code in the front matter of your SQL statement:
-- annotations:
-- - type: your.own.Annotation
-- members:
-- - key: someMember
-- value: this is your value
-- type: java.lang.String
-- - key: another
-- value: 5
-- type: int
-- - type: your.other.Annotation
-- members:
-- - key: value
-- value: yep
-- - type: some.annotation.WithoutMembers
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
The default no-op
implementation for a logging generator. It won’t generate any logging statements in your generated code.
The java.util.logging
based implementation for a logging generator. The generated code does not require any external non-JDK classes. All loggers use the basePackageName as their base name.
The log4j based implementation for a logging generator. All loggers use the basePackageName as their base name.
The slf4j based implementation for a logging generator. All loggers use the basePackageName as their base name.
The System.Logger based implementation for a logging generator.
The Tinylog based implementation for a logging generator.
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --logging-api=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --api=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The api
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
logging {
api.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
logging {
api = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The api
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<logging>
<api>configValue</api>
</logging>
</configuration>
</plugin>
</plugins>
</build>
The default value of the apiVersion
configuration option is 17
. It is updated alongside the minimum Java version required by YoSQL
.
Changing the apiVersion
configuration option to 11
will allow generated code to use Java APIs up until version 11 (including).
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --java-api-version=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --api-version=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The apiVersion
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
java {
apiVersion.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
java {
apiVersion = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The apiVersion
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<java>
<apiVersion>configValue</apiVersion>
</java>
</configuration>
</plugin>
</plugins>
</build>
The default value of the basePackageName
configuration option is com.example.persistence
. Setting the option to com.example.persistence
therefore produces the same code generated as the default configuration without any configuration option set. It produces code similar to this:
package com.example.persistence;
public class SomeRepository {
// ... rest of generated code
}
Changing the basePackageName
configuration option to your.own.domain
generates the following code instead:
package your.own.domain;
public class SomeRepository {
// ... rest of generated code (same as above)
}
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-base-package-name=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --base-package-name=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The basePackageName
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
basePackageName.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
basePackageName = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The basePackageName
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<basePackageName>configValue</basePackageName>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-batch=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --batch=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The batch
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
batch.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
batch = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The batch
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<batch>configValue</batch>
</names>
</configuration>
</plugin>
</plugins>
</build>
The default value for catchAndRethrow
is true
. This will catch any SQLException
that happen during SQL execution and re-throw them as RuntimeExceptions
.
package com.example.persistence;
public class SomeRepository {
public void writeSome() {
// ... some code
}
// ... rest of generated code
}
In case you want to handle SQLException
s yourself, set catchAndRethrow
to false
.
package com.example.persistence;
import java.sql.SQLException;
public class SomeRepository {
public void writeSome() throws SQLException {
// ... some code
}
// ... rest of generated code
}
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-catch-and-rethrow=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --catch-and-rethrow=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The catchAndRethrow
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
catchAndRethrow.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
catchAndRethrow = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The catchAndRethrow
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<catchAndRethrow>configValue</catchAndRethrow>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
The default value for catchAndRethrow
is true
. This will catch any SQLException
that happen during SQL execution and re-throw them as RuntimeExceptions
.
package com.example.persistence;
public class SomeRepository {
public void writeSome() {
// ... some code
}
// ... rest of generated code
}
In case you want to handle SQLException
s yourself, set catchAndRethrow
to false
.
package com.example.persistence;
import java.sql.SQLException;
public class SomeRepository {
public void writeSome() throws SQLException {
// ... some code
}
// ... rest of generated code
}
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to configure this option, place the following code in the front matter of your SQL statement:
-- catchAndRethrow: configValue
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
The default value of the classComment
configuration option is DO NOT MODIFY - automatically generated by YoSQL
. Setting the option to PROCESSING_API
therefore produces the same code generated as the default configuration.
package com.example.persistence;
import javax.annotation.processing.Generated;
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
public class SomeRepository {
// ... rest of generated code
}
Changing the classComment
configuration option to Hello World!
produces the following code:
package com.example.persistence;
import javax.annotation.Generated;
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "Hello World!"
)
public class SomeRepository {
// ... rest of generated code (same as above)
}
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --annotations-class-comment=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --class-comment=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The classComment
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
annotations {
classComment.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
annotations {
classComment = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The classComment
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<annotations>
<classComment>configValue</classComment>
</annotations>
</configuration>
</plugin>
</plugins>
</build>
The default value of the classMembers
configuration option is WITHOUT_DATE
. Setting the option to WITHOUT_DATE
therefore produces the same code generated as the default configuration.
package com.example.persistence;
import javax.annotation.processing.Generated;
@Generated(
value = "YoSQL",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
public class SomeRepository {
// ... rest of generated code
}
Changing the classMembers
configuration option to ALL
outputs all annotation members.
package com.example.persistence;
import javax.annotation.processing.Generated;
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
public class SomeRepository {
// ... rest of generated code (same as above)
}
Changing the classMembers
configuration option to NONE
outputs no annotation members.
package com.example.persistence;
import javax.annotation.processing.Generated;
@Generated
public class SomeRepository {
// ... rest of generated code (same as above)
}
Changing the classMembers
configuration option to VALUE
outputs only the value
member.
package com.example.persistence;
import javax.annotation.processing.Generated;
@Generated(
value = "YoSQL"
)
public class SomeRepository {
// ... rest of generated code (same as above)
}
Changing the classMembers
configuration option to DATE
outputs only the date
member.
package com.example.persistence;
import javax.annotation.processing.Generated;
@Generated(
date = "<current_timestamp>"
)
public class SomeRepository {
// ... rest of generated code (same as above)
}
Changing the classMembers
configuration option to COMMENT
outputs only the comment
member.
package com.example.persistence;
import javax.annotation.processing.Generated;
@Generated(
comment = "DO NOT MODIFY - automatically generated by YoSQL"
)
public class SomeRepository {
// ... rest of generated code (same as above)
}
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --annotations-class-members=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --class-members=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The classMembers
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
annotations {
classMembers.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
annotations {
classMembers = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The classMembers
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<annotations>
<classMembers>configValue</classMembers>
</annotations>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-column-count=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --column-count=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The columnCount
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
columnCount.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
columnCount = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The columnCount
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<columnCount>configValue</columnCount>
</names>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-column-label=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --column-label=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The columnLabel
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
columnLabel.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
columnLabel = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The columnLabel
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<columnLabel>configValue</columnLabel>
</names>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-connection=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --connection=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The connection
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
connection.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
connection = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The connection
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<connection>configValue</connection>
</names>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --annotations-constructor-annotations=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --constructor-annotations=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The constructorAnnotations
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
annotations {
constructorAnnotations.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
annotations {
constructorAnnotations = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The constructorAnnotations
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<annotations>
<constructorAnnotations>configValue</constructorAnnotations>
</annotations>
</configuration>
</plugin>
</plugins>
</build>
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-create-connection=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --create-connection=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The createConnection
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
createConnection.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
createConnection = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The createConnection
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<createConnection>configValue</createConnection>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to configure this option, place the following code in the front matter of your SQL statement:
-- createConnection: configValue
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-database-meta-data=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --database-meta-data=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The databaseMetaData
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
databaseMetaData.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
databaseMetaData = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The databaseMetaData
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<databaseMetaData>configValue</databaseMetaData>
</names>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-database-product-name=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --database-product-name=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The databaseProductName
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
databaseProductName.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
databaseProductName = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The databaseProductName
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<databaseProductName>configValue</databaseProductName>
</names>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-data-source=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --data-source=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The dataSource
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
dataSource.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
dataSource = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The dataSource
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<dataSource>configValue</dataSource>
</names>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --converter-default-converter=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --default-converter=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The defaultConverter
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
converter {
defaultConverter.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
converter {
defaultConverter = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The defaultConverter
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<converter>
<defaultConverter>configValue</defaultConverter>
</converter>
</configuration>
</plugin>
</plugins>
</build>
In case you use the description
option, YoSQL
will use the supplied value as a JavaDoc comment
package com.example.persistence;
public class SomeRepository {
/**
* Some random description
*/
public void someMethod() {
// ... some code
}
// ... rest of generated code
}
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to configure this option, place the following code in the front matter of your SQL statement:
-- description: configValue
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-exception=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --exception=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The exception
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
exception.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
exception = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The exception
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<exception>configValue</exception>
</names>
</configuration>
</plugin>
</plugins>
</build>
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-execute-batch=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --execute-batch=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The executeBatch
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
executeBatch.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
executeBatch = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The executeBatch
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<executeBatch>configValue</executeBatch>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to configure this option, place the following code in the front matter of your SQL statement:
-- executeBatch: configValue
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
The default value for executeBatchPrefix
is the empty string. It does not add any prefix in front of batch methods.
package com.example.persistence;
public class SomeRepository {
public void writeSomeBatch() {
// ... some code
}
// ... rest of generated code
}
In case you want to prefix batch methods with something, set the executeBatchPrefix
option.
package com.example.persistence;
public class SomeRepository {
public void myPrefixWriteSomeBatch() {
// ... some code
}
// ... rest of generated code
}
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-execute-batch-prefix=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --execute-batch-prefix=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The executeBatchPrefix
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
executeBatchPrefix.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
executeBatchPrefix = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The executeBatchPrefix
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<executeBatchPrefix>configValue</executeBatchPrefix>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
The default value for executeBatchPrefix
is the empty string. It does not add any prefix in front of batch methods.
package com.example.persistence;
public class SomeRepository {
public void writeSomeBatch() {
// ... some code
}
// ... rest of generated code
}
In case you want to prefix batch methods with something, set the executeBatchPrefix
option.
package com.example.persistence;
public class SomeRepository {
public void myPrefixWriteSomeBatch() {
// ... some code
}
// ... rest of generated code
}
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to configure this option, place the following code in the front matter of your SQL statement:
-- executeBatchPrefix: configValue
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
The default value for executeBatchSuffix
is ‘Batch’. It adds the word ‘Batch’ after each batch method.
package com.example.persistence;
public class SomeRepository {
public void writeSomeBatch() {
// ... some code
}
// ... rest of generated code
}
In case you want to suffix batch methods with something else, set the executeBatchSuffix
option.
package com.example.persistence;
public class SomeRepository {
public void writeSomeOther() {
// ... some code
}
// ... rest of generated code
}
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-execute-batch-suffix=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --execute-batch-suffix=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The executeBatchSuffix
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
executeBatchSuffix.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
executeBatchSuffix = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The executeBatchSuffix
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<executeBatchSuffix>configValue</executeBatchSuffix>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
The default value for executeBatchSuffix
is ‘Batch’. It adds the word ‘Batch’ after each batch method.
package com.example.persistence;
public class SomeRepository {
public void writeSomeBatch() {
// ... some code
}
// ... rest of generated code
}
In case you want to suffix batch methods with something else, set the executeBatchSuffix
option.
package com.example.persistence;
public class SomeRepository {
public void writeSomeOther() {
// ... some code
}
// ... rest of generated code
}
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to configure this option, place the following code in the front matter of your SQL statement:
-- executeBatchSuffix: configValue
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-executed-query=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --executed-query=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The executedQuery
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
executedQuery.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
executedQuery = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The executedQuery
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<executedQuery>configValue</executedQuery>
</names>
</configuration>
</plugin>
</plugins>
</build>
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-execute-once=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --execute-once=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The executeOnce
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
executeOnce.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
executeOnce = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The executeOnce
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<executeOnce>configValue</executeOnce>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to configure this option, place the following code in the front matter of your SQL statement:
-- executeOnce: configValue
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
The default value for executeOncePrefix
is the empty string. It does not add any prefix in front of methods that are executed once.
package com.example.persistence;
public class SomeRepository {
public void writeSome() {
// ... some code
}
// ... rest of generated code
}
In case you want to prefix methods that execute once with something, set the executeOncePrefix
option.
package com.example.persistence;
public class SomeRepository {
public void myPrefixWriteSome() {
// ... some code
}
// ... rest of generated code
}
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-execute-once-prefix=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --execute-once-prefix=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The executeOncePrefix
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
executeOncePrefix.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
executeOncePrefix = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The executeOncePrefix
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<executeOncePrefix>configValue</executeOncePrefix>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
The default value for executeOncePrefix
is the empty string. It does not add any prefix in front of methods that are executed once.
package com.example.persistence;
public class SomeRepository {
public void writeSome() {
// ... some code
}
// ... rest of generated code
}
In case you want to prefix methods that execute once with something, set the executeOncePrefix
option.
package com.example.persistence;
public class SomeRepository {
public void myPrefixWriteSome() {
// ... some code
}
// ... rest of generated code
}
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to configure this option, place the following code in the front matter of your SQL statement:
-- executeOncePrefix: configValue
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
The default value for executeOnceSuffix
is the empty string. It does not add any suffix after methods that execute once.
package com.example.persistence;
public class SomeRepository {
public void writeSome() {
// ... some code
}
// ... rest of generated code
}
In case you want to suffix methods that execute once with something, set the executeOnceSuffix
option.
package com.example.persistence;
public class SomeRepository {
public void writeSomeMySuffix() {
// ... some code
}
// ... rest of generated code
}
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-execute-once-suffix=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --execute-once-suffix=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The executeOnceSuffix
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
executeOnceSuffix.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
executeOnceSuffix = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The executeOnceSuffix
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<executeOnceSuffix>configValue</executeOnceSuffix>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
The default value for executeOnceSuffix
is the empty string. It does not add any suffix after methods that execute once.
package com.example.persistence;
public class SomeRepository {
public void writeSome() {
// ... some code
}
// ... rest of generated code
}
In case you want to suffix methods that execute once with something, set the executeOnceSuffix
option.
package com.example.persistence;
public class SomeRepository {
public void writeSomeMySuffix() {
// ... some code
}
// ... rest of generated code
}
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to configure this option, place the following code in the front matter of your SQL statement:
-- executeOnceSuffix: configValue
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
The default value of the fieldComment
configuration option is DO NOT MODIFY - automatically generated by YoSQL
. Setting the option to DO NOT MODIFY - automatically generated by YoSQL
therefore produces the same code generated as the default configuration.
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
private Object someField;
// ... rest of generated code
}
Changing the fieldComment
configuration option to Hello World!
produces the following code:
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "Hello World!"
)
private Object someField;
// ... rest of generated code
}
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --annotations-field-comment=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --field-comment=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The fieldComment
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
annotations {
fieldComment.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
annotations {
fieldComment = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The fieldComment
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<annotations>
<fieldComment>configValue</fieldComment>
</annotations>
</configuration>
</plugin>
</plugins>
</build>
The default value of the fieldMembers
configuration option is WITHOUT_DATE
. Setting the option to WITHOUT_DATE
therefore produces the same code generated as the default configuration.
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated(
value = "YoSQL",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
private Object someField;
// ... rest of generated code
}
Changing the fieldMembers
configuration option to ALL
outputs all annotation members.
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
private Object someField;
// ... rest of generated code
}
Changing the fieldMembers
configuration option to NONE
outputs no annotation members.
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated
private Object someField;
// ... rest of generated code
}
Changing the fieldMembers
configuration option to VALUE
outputs only the value
member.
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated(
value = "YoSQL"
)
private Object someField;
// ... rest of generated code
}
Changing the fieldMembers
configuration option to DATE
outputs only the date
member.
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated(
date = "<current_timestamp>"
)
private Object someField;
// ... rest of generated code
}
Changing the fieldMembers
configuration option to COMMENT
outputs only the comment
member.
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated(
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
private Object someField;
// ... rest of generated code
}
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --annotations-field-members=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --field-members=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The fieldMembers
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
annotations {
fieldMembers.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
annotations {
fieldMembers = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The fieldMembers
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<annotations>
<fieldMembers>configValue</fieldMembers>
</annotations>
</configuration>
</plugin>
</plugins>
</build>
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-generate-interfaces=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --generate-interfaces=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The generateInterfaces
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
generateInterfaces.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
generateInterfaces = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The generateInterfaces
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<generateInterfaces>configValue</generateInterfaces>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --converter-generate-map-converter=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --generate-map-converter=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The generateMapConverter
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
converter {
generateMapConverter.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
converter {
generateMapConverter = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The generateMapConverter
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<converter>
<generateMapConverter>configValue</generateMapConverter>
</converter>
</configuration>
</plugin>
</plugins>
</build>
The default value of the generatorName
configuration option is YoSQL
. Setting the option to YoSQL
therefore produces the same code generated as the default configuration.
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
private Object someField;
// ... rest of generated code
}
Changing the generatorName
configuration option to Hello World!
produces the following code:
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated(
value = "Hello World!",
date = "<current_timestamp>",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
private Object someField;
// ... rest of generated code
}
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --annotations-generator-name=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --generator-name=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The generatorName
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
annotations {
generatorName.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
annotations {
generatorName = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The generatorName
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<annotations>
<generatorName>configValue</generatorName>
</annotations>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-index-suffix=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --index-suffix=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The indexSuffix
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
indexSuffix.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
indexSuffix = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The indexSuffix
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<indexSuffix>configValue</indexSuffix>
</names>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-index-variable=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --index-variable=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The indexVariable
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
indexVariable.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
indexVariable = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The indexVariable
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<indexVariable>configValue</indexVariable>
</names>
</configuration>
</plugin>
</plugins>
</build>
The default value of the injectConverters
configuration option is false
. It produces code similar to this:
package com.example.persistence;
public class SomeRepository {
private final DataSource dataSource;
private final ToMapConverter toMap;
public SomeRepository(final DataSource dataSource) {
this.dataSource = dataSource;
this.toMap = new ToMapConverter();
}
// ... rest of generated code
}
Changing the injectConverters
configuration option to true
generates the following code instead:
package your.own.domain;
public class SomeRepository {
private final DataSource dataSource;
private final ToMapConverter toMap;
public SomeRepository(final DataSource dataSource, final ToMapConverter toMap) {
this.dataSource = dataSource;
this.toMap = toMap;
}
// ... rest of generated code
}
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-inject-converters=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --inject-converters=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The injectConverters
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
injectConverters.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
injectConverters = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The injectConverters
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<injectConverters>configValue</injectConverters>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
The default value of the inputBaseDirectory
configuration option used by the Ant- and CLI-tooling is .
- the current directory.
The default value of the inputBaseDirectory
configuration option used by the Gradle- and Maven-tooling is src/main/yosql
to better reflect the commonly used project structure expected by those tools.
Changing the inputBaseDirectory
configuration option to some/other/directory!
configures YoSQL
to look into the path relative directory some/other/directory
.
Changing the inputBaseDirectory
configuration option to /an/absolute/path!
configures YoSQL
to look into the absolute directory path /an/absolute/path
.
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --files-input-base-directory=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --input-base-directory=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The inputBaseDirectory
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
files {
inputBaseDirectory.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
files {
inputBaseDirectory = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The inputBaseDirectory
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<files>
<inputBaseDirectory>configValue</inputBaseDirectory>
</files>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-jdbc-index-variable=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --jdbc-index-variable=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The jdbcIndexVariable
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
jdbcIndexVariable.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
jdbcIndexVariable = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The jdbcIndexVariable
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<jdbcIndexVariable>configValue</jdbcIndexVariable>
</names>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-list=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --list=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The list
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
list.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
list = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The list
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<list>configValue</list>
</names>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-logger=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --logger=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The logger
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
logger.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
logger = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The logger
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<logger>configValue</logger>
</names>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --converter-map-converter-alias=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --map-converter-alias=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The mapConverterAlias
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
converter {
mapConverterAlias.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
converter {
mapConverterAlias = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The mapConverterAlias
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<converter>
<mapConverterAlias>configValue</mapConverterAlias>
</converter>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --converter-map-converter-class=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --map-converter-class=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The mapConverterClass
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
converter {
mapConverterClass.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
converter {
mapConverterClass = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The mapConverterClass
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<converter>
<mapConverterClass>configValue</mapConverterClass>
</converter>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --converter-map-converter-method=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --map-converter-method=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The mapConverterMethod
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
converter {
mapConverterMethod.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
converter {
mapConverterMethod = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The mapConverterMethod
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<converter>
<mapConverterMethod>configValue</mapConverterMethod>
</converter>
</configuration>
</plugin>
</plugins>
</build>
The maximum number will be capped to the number of available CPU cores of your system.
The default value of the maxThreads
configuration option is 1
which uses one thread to generate code.
Changing the maxThreads
configuration option to 123
will use the available number of CPU cores in your system or 123 threads, depending on which is lower.
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --resources-max-threads=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --max-threads=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The maxThreads
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
resources {
maxThreads.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
resources {
maxThreads = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The maxThreads
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<resources>
<maxThreads>configValue</maxThreads>
</resources>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --annotations-method-annotations=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --method-annotations=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The methodAnnotations
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
annotations {
methodAnnotations.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
annotations {
methodAnnotations = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The methodAnnotations
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<annotations>
<methodAnnotations>configValue</methodAnnotations>
</annotations>
</configuration>
</plugin>
</plugins>
</build>
The default value of the methodComment
configuration option is DO NOT MODIFY - automatically generated by YoSQL
. Setting the option to DO NOT MODIFY - automatically generated by YoSQL
therefore produces the same code generated as the default configuration.
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
public void someMethod() {
// ... some code
}
// ... rest of generated code
}
Changing the methodComment
configuration option to Hello World!
produces the following code:
package com.example.persistence;
import javax.annotation.Generated;
public class SomeRepository {
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "Hello World!"
)
public void someMethod() {
// ... some code
}
// ... rest of generated code
}
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --annotations-method-comment=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --method-comment=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The methodComment
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
annotations {
methodComment.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
annotations {
methodComment = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The methodComment
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<annotations>
<methodComment>configValue</methodComment>
</annotations>
</configuration>
</plugin>
</plugins>
</build>
The default value of the methodMembers
configuration option is WITHOUT_DATE
. Setting the option to WITHOUT_DATE
therefore produces the same code generated as the default configuration.
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated(
value = "YoSQL",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
public void someMethod() {
// ... some code
}
// ... rest of generated code
}
Changing the methodMembers
configuration option to ALL
outputs all annotation members.
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated(
value = "YoSQL",
date = "<current_timestamp>",
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
public void someMethod() {
// ... some code
}
// ... rest of generated code (same as above)
}
Changing the methodMembers
configuration option to NONE
outputs no annotation members.
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated
public void someMethod() {
// ... some code
}
// ... rest of generated code (same as above)
}
Changing the methodMembers
configuration option to VALUE
outputs only the value
member.
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated(
value = "YoSQL"
)
public void someMethod() {
// ... some code
}
// ... rest of generated code (same as above)
}
Changing the methodMembers
configuration option to DATE
outputs only the date
member.
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated(
date = "<current_timestamp>"
)
public void someMethod() {
// ... some code
}
// ... rest of generated code (same as above)
}
Changing the methodMembers
configuration option to COMMENT
outputs only the comment
member.
package com.example.persistence;
import javax.annotation.processing.Generated;
public class SomeRepository {
@Generated(
comments = "DO NOT MODIFY - automatically generated by YoSQL"
)
public void someMethod() {
// ... some code
}
// ... rest of generated code (same as above)
}
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --annotations-method-members=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --method-members=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The methodMembers
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
annotations {
methodMembers.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
annotations {
methodMembers = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The methodMembers
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<annotations>
<methodMembers>configValue</methodMembers>
</annotations>
</configuration>
</plugin>
</plugins>
</build>
In case you use the name
option, YoSQL
will use the supplied value as a method name
package com.example.persistence;
public class SomeRepository {
public void yourSpecialName() {
// ... some code
}
// ... rest of generated code
}
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to configure this option, place the following code in the front matter of your SQL statement:
-- name: configValue
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
The default value of the outputBaseDirectory
configuration option is .
- the current directory. Note that tooling may change the default output base directory to better reflect a typical project structure used with such a tool.
Changing the outputBaseDirectory
configuration option to some/other/directory!
configures YoSQL
to write into the relative directorysome/other/directory
.
Changing the outputBaseDirectory
configuration option to /an/absolute/path!
configures YoSQL
to write into the absolute directory path /an/absolute/path
.
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --files-output-base-directory=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --output-base-directory=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The outputBaseDirectory
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
files {
outputBaseDirectory.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
files {
outputBaseDirectory = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The outputBaseDirectory
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<files>
<outputBaseDirectory>configValue</outputBaseDirectory>
</files>
</configuration>
</plugin>
</plugins>
</build>
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to configure this option, place the following code in the front matter of your SQL statement:
-- parameters: configValue
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-query=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --query=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The query
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
query.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
query = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The query
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<query>configValue</query>
</names>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-raw-query=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --raw-query=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The rawQuery
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
rawQuery.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
rawQuery = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The rawQuery
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<rawQuery>configValue</rawQuery>
</names>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-raw-suffix=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --raw-suffix=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The rawSuffix
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
rawSuffix.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
rawSuffix = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The rawSuffix
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<rawSuffix>configValue</rawSuffix>
</names>
</configuration>
</plugin>
</plugins>
</build>
In order to overwrite the target repository of a single SQL statement, use the repository
option.
You can specify the fully qualified name of the repository that should contain your statement, or
you can just specify the name of the class and YoSQL
will automatically add the
base package name as well as the
repositoryNamePrefix and
repositoryNameSuffix for you.
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to configure this option, place the following code in the front matter of your SQL statement:
-- repository: configValue
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --annotations-repository-annotations=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --repository-annotations=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The repositoryAnnotations
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
annotations {
repositoryAnnotations.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
annotations {
repositoryAnnotations = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The repositoryAnnotations
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<annotations>
<repositoryAnnotations>configValue</repositoryAnnotations>
</annotations>
</configuration>
</plugin>
</plugins>
</build>
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-repository-interface-prefix=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --repository-interface-prefix=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The repositoryInterfacePrefix
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
repositoryInterfacePrefix.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
repositoryInterfacePrefix = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The repositoryInterfacePrefix
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<repositoryInterfacePrefix>configValue</repositoryInterfacePrefix>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-repository-interface-suffix=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --repository-interface-suffix=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The repositoryInterfaceSuffix
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
repositoryInterfaceSuffix.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
repositoryInterfaceSuffix = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The repositoryInterfaceSuffix
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<repositoryInterfaceSuffix>configValue</repositoryInterfaceSuffix>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
In case the repository name already contains the configured prefix, it will not be added twice.
The default value of the repositoryNamePrefix
configuration option is the empty string. Setting the option to `` therefore produces the same code generated as the default configuration without any configuration option set. It produces code similar to this:
package com.example.persistence;
public class SomeRepository {
// ... rest of generated code
}
Changing the repositoryNamePrefix
configuration option to Database
generates the following code instead:
package com.example.persistence;
public class DatabaseSomeRepo {
// ... rest of generated code (same as above)
}
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-repository-name-prefix=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --repository-name-prefix=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The repositoryNamePrefix
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
repositoryNamePrefix.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
repositoryNamePrefix = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The repositoryNamePrefix
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<repositoryNamePrefix>configValue</repositoryNamePrefix>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
In case the repository name already contains the configured suffix, it will not be added twice.
The default value of the repositoryNameSuffix
configuration option is Repository
. Setting the option to Repository
therefore produces the same code generated as the default configuration without any configuration option set. It produces code similar to this:
package com.example.persistence;
public class SomeRepository {
// ... rest of generated code
}
Changing the repositoryNameSuffix
configuration option to Repo
generates the following code instead:
package com.example.persistence;
public class SomeRepo {
// ... rest of generated code (same as above)
}
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-repository-name-suffix=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --repository-name-suffix=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The repositoryNameSuffix
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
repositoryNameSuffix.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
repositoryNameSuffix = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The repositoryNameSuffix
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<repositoryNameSuffix>configValue</repositoryNameSuffix>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to configure this option, place the following code in the front matter of your SQL statement:
-- resultRowConverter: configValue
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-result-set=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --result-set=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The resultSet
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
resultSet.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
resultSet = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The resultSet
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<resultSet>configValue</resultSet>
</names>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-result-set-meta-data=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --result-set-meta-data=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The resultSetMetaData
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
resultSetMetaData.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
resultSetMetaData = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The resultSetMetaData
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<resultSetMetaData>configValue</resultSetMetaData>
</names>
</configuration>
</plugin>
</plugins>
</build>
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to configure this option, place the following code in the front matter of your SQL statement:
-- returningMode: configValue
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-row=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --row=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The row
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
row.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
row = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The row
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<row>configValue</row>
</names>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --converter-row-converters=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --row-converters=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The rowConverters
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
converter {
rowConverters.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
converter {
rowConverters = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The rowConverters
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<converter>
<rowConverters>configValue</rowConverters>
</converter>
</configuration>
</plugin>
</plugins>
</build>
The default value of the skipLines
configuration option is 0
- which does not skip any lines.
Changing the skipLines
configuration option to 5
configures YoSQL
skip the first 5 lines in each .sql
file in encounters.
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --files-skip-lines=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --skip-lines=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The skipLines
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
files {
skipLines.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
files {
skipLines = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The skipLines
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<files>
<skipLines>configValue</skipLines>
</files>
</configuration>
</plugin>
</plugins>
</build>
The default value of the sqlFilesCharset
configuration option is UTF-8
which should work on most systems.
Changing the sqlFilesCharset
configuration option to ISO-8859-1
configures YoSQL
to use the ISO-8859-1
charset while reading your .sql
files.
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --files-sql-files-charset=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --sql-files-charset=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The sqlFilesCharset
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
files {
sqlFilesCharset.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
files {
sqlFilesCharset = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The sqlFilesCharset
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<files>
<sqlFilesCharset>configValue</sqlFilesCharset>
</files>
</configuration>
</plugin>
</plugins>
</build>
The default value of the sqlFilesSuffix
configuration option is .sql
. It matches all files that end with .sql
.
Changing the sqlFilesSuffix
configuration option to .other
configures YoSQL
look for files that end in .other
.
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --files-sql-files-suffix=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --sql-files-suffix=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The sqlFilesSuffix
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
files {
sqlFilesSuffix.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
files {
sqlFilesSuffix = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The sqlFilesSuffix
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<files>
<sqlFilesSuffix>configValue</sqlFilesSuffix>
</files>
</configuration>
</plugin>
</plugins>
</build>
The default value of the sqlStatementSeparator
configuration option is .sql
. It matches all files that end with .sql
.
Changing the sqlStatementSeparator
configuration option to |
configures YoSQL
split .sql
files using the |
character.
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --files-sql-statement-separator=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --sql-statement-separator=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The sqlStatementSeparator
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
files {
sqlStatementSeparator.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
files {
sqlStatementSeparator = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The sqlStatementSeparator
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<files>
<sqlStatementSeparator>configValue</sqlStatementSeparator>
</files>
</configuration>
</plugin>
</plugins>
</build>
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --names-statement=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --statement=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The statement
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
names {
statement.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
names {
statement = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The statement
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<names>
<statement>configValue</statement>
</names>
</configuration>
</plugin>
</plugins>
</build>
ReturningMode.SINGLE
produces more than 1 result.
ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-throw-on-multiple-results=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --throw-on-multiple-results=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The throwOnMultipleResults
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
throwOnMultipleResults.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
throwOnMultipleResults = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The throwOnMultipleResults
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<throwOnMultipleResults>configValue</throwOnMultipleResults>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
ReturningMode.SINGLE
produces more than 1 result.
ReturningMode.NONE
return the number of affected rows instead.In order to configure this option, place the following code in the front matter of your SQL statement:
-- throwOnMultipleResults: configValue
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to configure this option, place the following code in the front matter of your SQL statement:
-- type: configValue
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
The default value of the useFinalClasses
configuration option is true
which enables the use of final
for classes.
Changing the useFinalClasses
configuration option to false
disables the use of final
for classes.
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --java-use-final-classes=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --use-final-classes=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The useFinalClasses
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
java {
useFinalClasses.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
java {
useFinalClasses = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The useFinalClasses
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<java>
<useFinalClasses>configValue</useFinalClasses>
</java>
</configuration>
</plugin>
</plugins>
</build>
The default value of the useFinalFields
configuration option is true
which enables the use of final
for fields.
Changing the useFinalFields
configuration option to false
disables the use of final
for fields.
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --java-use-final-fields=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --use-final-fields=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The useFinalFields
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
java {
useFinalFields.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
java {
useFinalFields = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The useFinalFields
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<java>
<useFinalFields>configValue</useFinalFields>
</java>
</configuration>
</plugin>
</plugins>
</build>
The default value of the useFinalMethods
configuration option is true
which enables the use of final
for methods.
Changing the useFinalMethods
configuration option to false
disables the use of final
for methods.
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --java-use-final-methods=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --use-final-methods=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The useFinalMethods
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
java {
useFinalMethods.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
java {
useFinalMethods = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The useFinalMethods
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<java>
<useFinalMethods>configValue</useFinalMethods>
</java>
</configuration>
</plugin>
</plugins>
</build>
The default value of the useFinalParameters
configuration option is true
which enables the use of final
for parameters.
Changing the useFinalParameters
configuration option to false
disables the use of final
for parameters.
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --java-use-final-parameters=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --use-final-parameters=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The useFinalParameters
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
java {
useFinalParameters.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
java {
useFinalParameters = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The useFinalParameters
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<java>
<useFinalParameters>configValue</useFinalParameters>
</java>
</configuration>
</plugin>
</plugins>
</build>
The default value of the useFinalVariables
configuration option is true
which enables the use of final
for variables.
Changing the useFinalVariables
configuration option to false
disables the use of final
for variables.
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --java-use-final-variables=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --use-final-variables=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The useFinalVariables
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
java {
useFinalVariables.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
java {
useFinalVariables = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The useFinalVariables
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<java>
<useFinalVariables>configValue</useFinalVariables>
</java>
</configuration>
</plugin>
</plugins>
</build>
The default value of the useSealedInterfaces
configuration option is false
which disables sealing interfaces in generated code.
Changing the useSealedInterfaces
configuration option to true
enables sealing interfaces in generated code.
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --java-use-sealed-interfaces=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --use-sealed-interfaces=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The useSealedInterfaces
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
java {
useSealedInterfaces.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
java {
useSealedInterfaces = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The useSealedInterfaces
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<java>
<useSealedInterfaces>configValue</useSealedInterfaces>
</java>
</configuration>
</plugin>
</plugins>
</build>
The default value of the useTextBlocks
configuration option is true
which enables the use of text blocks in generated code.
Changing the useTextBlocks
configuration option to false
disables the use of text blocks in generated code.
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --java-use-text-blocks=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --use-text-blocks=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The useTextBlocks
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
java {
useTextBlocks.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
java {
useTextBlocks = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The useTextBlocks
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<java>
<useTextBlocks>configValue</useTextBlocks>
</java>
</configuration>
</plugin>
</plugins>
</build>
The default value of the useVar
configuration option is true
which enables the use of var
in generated code.
Changing the useVar
configuration option to false
disables the use of var
in generated code.
In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --java-use-var=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --use-var=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The useVar
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
java {
useVar.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
java {
useVar = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The useVar
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<java>
<useVar>configValue</useVar>
</java>
</configuration>
</plugin>
</plugins>
</build>
The default value of the validateMethodNamePrefixes
configuration option is false
which disables the validation of names according to your configured prefixes.
Changing the validateMethodNamePrefixes
configuration option to true
enables the validation of method names.
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-validate-method-name-prefixes=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --validate-method-name-prefixes=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The validateMethodNamePrefixes
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
validateMethodNamePrefixes.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
validateMethodNamePrefixes = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The validateMethodNamePrefixes
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<validateMethodNamePrefixes>configValue</validateMethodNamePrefixes>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
ReturningMode.SINGLE
produces more than 1 result.ReturningMode.NONE
return the number of affected rows instead.In order to configure this option, place the following code in the front matter of your SQL statement:
-- vendor: configValue
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
ReturningMode.NONE
return the number of affected rows instead.
ReturningMode.SINGLE
produces more than 1 result.In order to use YoSQL
together with Ant, take a look at the tooling documentation for Ant.
In order to use YoSQL
together with Bazel, take a look at the tooling documentation for Bazel.
In order to use YoSQL
on the command line, take a look at the tooling documentation for CLI.
$ yosql --repositories-writes-return-update-count=configValue
As long as the name of the config option is unique across all configuration groups, you can use the shorter form:
$ yosql --writes-return-update-count=configValue
In order to use YoSQL
together with Gradle, take a look at the tooling documentation for Gradle. The writesReturnUpdateCount
setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2023.2.22"
}
yosql {
repositories {
writesReturnUpdateCount.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2023.2.22"
}
yosql {
repositories {
writesReturnUpdateCount = configValue
}
}
In order to use YoSQL
together with Maven, take a look at the tooling documentation for Maven. The writesReturnUpdateCount
setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<writesReturnUpdateCount>configValue</writesReturnUpdateCount>
</repositories>
</configuration>
</plugin>
</plugins>
</build>
ReturningMode.NONE
return the number of affected rows instead.
ReturningMode.SINGLE
produces more than 1 result.In order to configure this option, place the following code in the front matter of your SQL statement:
-- writesReturnUpdateCount: configValue
SELECT something
FROM your_database_schema
WHERE some_column = :some_value
java.sql.ResultSet
into some other type. Each converter has an alias to make it easier to reference different converters without specifying their fully qualified name.
In case you do not want to use custom domain types, YoSQL
provides a built-in default converter that returns a Map<String, Object>
. That converter is declared as the defaultConverter if not otherwise specified by yourself, thus newly generated code will always return Map
s at first. You can disable generating the mapping converter by using generateMapConverter. You can change its location with mapConverterClass, its method name with mapConverterMethod and its alias with mapConverterAlias. Methods that use the mapping converter have a signature similar to this:
Optional<Map<String, Object>> someMethod()
List<Map<String, Object>> someMethod()
Stream<Map<String, Object>> someMethod()
If not otherwise specified, generated code will use the default converter to converter between java.sql.ResultSet
and some type declared by the configured default converter.
In case you want to adjust the converter used by all your statements, set the defaultConverter configuration option accordingly. By default, this points to the map converter mentioned above.
In order to use your own domain types in generated code, write a custom converter like in the following example and register each custom converter using the rowConverters configuration option:
package my.own;
import java.sql.ResultSet;
import java.sql.SQLException;
import my.own.User;
import my.own.persistence.util.ResultState;
public class UserConverter {
public User apply(ResultState result) throws SQLException {
ResultSet resultSet = result.getResultSet();
User pojo = new User();
pojo.setId(resultSet.getInt("id"));
pojo.setName(resultSet.getString("name"));
return pojo;
}
}
You can choose package, class name and method name at will. The converter method gives you full control about how you want to handle ResultSet
s. You can use your own converter either by specifying it as the default converter mentioned above or by declaring it as a resultRowConverter with either its fully qualified name or its alias like this in the front matter of your SQL statements:
-- resultRowConverter: my.own.UserConverter
SELECT *
FROM users
Generated code will now use your custom converter along with the result type configured for your converter, e.g.:
Optional<User> someMethod()
List<User> someMethod()
Stream<User> someMethod()
Tip: In case you want to use custom types, but do not want to write your own converter, consider using SimpleFlatMapper with its built-in support for JDBC ResultSet
s.
.sql
files is the essential work that needs to be done in order to use YoSQL
. Each file can contain multiple SQL statements. Each statement has its own configuration and metadata attached to it.
YoSQL
supports the tree types of SQL statements and is able to generate code for them: READING
for SQL statements that read data, WRITING
for SQL statements that write data, and CALLING
for SQL statements that call stored procedures.
In order to correctly guess which type your statement is, YoSQL
does not parse your SQL code, but uses the file name of your .sql
files or the name
front matter. It applies the following rules to determine the statement type from its name:
READING
type.WRITING
type.CALLING
type.SQL statements that cannot be mapped to one of the available types are not considered while generating code! You can always overwrite that guess with a specific type value in your front matter. This can be useful if you want to use a special name for your statement, but don’t want to adhere to the configured prefixes. On the other hand, enable validateMethodNamePrefixes to enforce that all statements are named accordingly to the configured prefixes.
Each SQL statement can have an optional front matter section written in YAML that is placed inside an SQL comment. Configuration options that are specified in a front matter of an SQL statement overwrite the same option that was specified globally, e.g. in a pom.xml
/build.gradle
file.
-- name: someName
-- description: Retrieves a single user
-- repository: com.example.persistence.YourRepository
-- vendor: H2
-- parameters:
-- - name: userId
-- type: int
-- type: reading
-- returning: one
-- catchAndRethrow: true
SELECT *
FROM users
WHERE id = :userId
While parsing your .sql
files, YoSQL
will strip the SQL comment prefix (--
) and read the remaining text as a YAML object. The available configuration options that can be used in the front matter, can be seen here.
By default, YoSQL
only considers files that end in .sql
, but this can be configured using the sqlFilesSuffix option. Lots of editors have built-in syntax support for SQL and they auto-enable that once you open an .sql
file, so we recommend to stick to the default and only change if it necessary.
By default, YoSQL
uses the UTF-8 charset. In order to change this, use the sqlFilesCharset option.
By default, YoSQL
uses ;
to separate multiple SQL statements within a single file. In order to change this, use the sqlStatementSeparator option.
-- name: firstStatement
SELECT *
FROM users
WHERE id = :userId
;
-- name: secondStatement
SELECT *
FROM customers
WHERE id = :customerId
;
In case your .sql
files contain a license header, use the skipLines option to skip those initial lines. Otherwise YoSQL
will consider those lines to be part of the first statement in your .sql
file.
java.util.logging
API in generated code.log4j
API in generated code.slf4j
API in generated code.tinylog
API in generated code.# run code generation benchmark
$ mvn --projects yosql-benchmarks/yosql-benchmarks-codegen --also-make --activate-profiles benchmarks verify
The above command will execute the four configurations mentioned at the top of this page. Each configuration uses repositories that contain:
Comparing code to benchmark, we are expecting that generating any kind of logging statement takes slightly longer than not generating any logging statements at all. Amongst the logging implementation, no observable performance difference can be measured. In case you are concerned about the total time it takes YoSQL
to generate code, disabling logging statements will make a difference, however the code generation process time can be measures in milliseconds even for very large sample sizes, thus you should probably look somewhere else to improve the total performance of your build. In order to avoid generating code altogether, consider creating repositories inside one module and depend on it in other modules.
The common scenarios define what each persistence solution must solve in order to pass the TCK. All benchmarks run through the following benchmarks:
readComplexRelationship
: Read a complex data relationship.readManyToOneRelation
: Reads the one part of a many-to-one relation.readMultipleEntities
: Read multiple entities in one go.readMultipleEntitiesBasedOnCondition
: Read multiple entities and filter them inside the database.readOneToManyRelation
: Reads the many part of a one-to-many relation.readSingleEntityByPrimaryKey
: Read a single entity using its primary key.writeMultipleEntities
: Writes multiple entities into the database.writeSingleEntity
: Writes a new entity into the database.updateOneToManyRelation
: Update the one-to-many relationship part of an entity.updateManyToOneRelation
: Update the many-to-one relationship part of an entity.deleteSingleEntityByPrimaryKey
: Delete a single entity using its primary key.callStoredProcedure
: Call a single stored procedure.In order to select the best matching persistence API for your project, performance might be taken into consideration. In general, we recommend to use whatever persistence API is already used in your project in order to minimize the number of dependencies.
In order to run JDBC benchmarks of YoSQL
run:
# run JDBC benchmarks
$ mvn --projects yosql-benchmarks/yosql-benchmarks-dao --also-make --activate-profiles benchmarks verify
The results are measured in microseconds. All available logging implementation are tested with their maximal output configuration in order to gauge how much overhead each implementation causes on top of the no-op implementation without any logging statements.
In order to compare a solution entirely based on YoSQL
against other persistence solutions, the following set of benchmarks was created. None of them use Yosql
and solely use own native persistence API itself.
In order to run benchmarks against EBean run:
# run EBean benchmarks
$ mvn --projects yosql-benchmarks/yosql-benchmarks-vs-ebean --also-make --activate-profiles benchmarks verify
In order to run benchmarks against JDBI implementation run:
# run JDBI benchmarks
$ mvn --projects yosql-benchmarks/yosql-benchmarks-vs-jdbi --also-make --activate-profiles benchmarks verify
In order to run benchmarks against jOOQ implementation run:
# run jOOQ benchmarks
$ mvn --projects yosql-benchmarks/yosql-benchmarks-vs-jooq --also-make --activate-profiles benchmarks verify
In order to run benchmarks against JPA implementation run:
# run JPA benchmarks
$ mvn --projects yosql-benchmarks/yosql-benchmarks-vs-jpa --also-make --activate-profiles benchmarks verify
YoSQL
will try to detect which repository your SQL statements will end up in. Based on the inputBaseDirectory configuration option, your project structure could look like this:
<inputBaseDirectory>/
└── user/
└── getAllUsers.sql
Based on the above example, YoSQL
will determine that you want a method called getAllUsers
in a repository called UserRepository
. Use the basePackageName option to change the base package name for all generated repositories. Together they will form the fully qualified name <basePackageName>.UserRepository
.
<inputBaseDirectory>/
└── internal/
└── user/
└── getAllUsers.sql
Nested package structures are supported as well - they are simply interpreted as subpackages, that are appended to the basePackageName option to form the fully qualified name <basePackageName>.internal.UserRepository
.
<inputBaseDirectory>/
└── user/
└── vips/
└── findSpecialUsers.sql
└── getAllUsers.sql
Nesting repositories within other repositories is supported as well - YoSql
will create two repositories for the above example: <basePackageName>.UserRepository
with a method called getAllUsers
and <basePackageName>.user.VipsRepository
with a method called findSpecialUsers
.
<inputBaseDirectory>/
└── internal/
└── user/
└── getAllUsers.sql
└── user/
└── findUser.sql
Mixing nested and non-nested repositories work as well. The above example will generate the two repositories <basePackageName>.internal.UserRepository
and <basePackageName>.UserRepository
.
<inputBaseDirectory>/
└── allQueries.sql
Smaller projects might just want to use a single .sql
file that contains all of your queries. In case none of your SQL statements change their target repository in their front matter, all queries in the above structure will end up in a class called <basePackageName>.Repository
.
<inputBaseDirectory>/
└── internal/
└── user/
└── vips/
└── findSpecialUsers.sql
└── getAllUsers.sql
└── user/
└── findUser.sql
└── lotsOfQueries.sql
Mixing all options is of course supported as well - we recommend using any structure that best fits to your project/team. One statement per file makes it easier to quickly find single statements, however grouping multiple statements together in one file might make sense for multiple reasons, e.g. a statement might have multiple variants based on the used database or any other set of statements that are usually changed together as a single unit.
]]>YoSQL
tooling for Ant, follow these steps:
yosql-tooling-ant
task zip file from the latest release (or any prior version).lib
folder of the yosql-tooling-ant
zip file contains all jar files that are required for the task..sql
files in a directory of your choice (e.g. /path/to/your/sql/files
).YoSQL
task.YoSQL
task in order to generate Java code.An example build.xml file could look like this:
<project name="YourProject">
<description>
example showing how to use YoSQL with Ant
</description>
<!-- define YoSQL task -->
<taskdef name="yosql"
classname="wtf.metio.yosql.tooling.ant.YoSQLGenerateTask"
classpath="/path/of/all/yosql/jar/files"/>
<!-- configure YoSQL -->
<yosql>
<files inputBaseDirectory="/path/to/your/sql/files"
outputBaseDirectory="/path/for/writing/java/code"/>
<repositories generateInterfaces="true"/>
<converter>
<rowConverters alias="yourConverter"
converterType="com.example.YourConverter"
methodName="yourCustomMethod"
resultType="com.example.YourDomainObject"/>
</converter>
</yosql>
</project>
yosql-tooling-cli
zip file from the latest release (or any prior version)..jar
files used by yosql-tooling-cli
java_import(
name = "yosql_tooling_cli",
jars = [
"lib/yosql-tooling-cli-x.y.z.jar",
"lib/yosql-codegen-x.y.z.jar",
"lib/yosql-models-immutables-x.y.z.jar",
... every other jar file from the 'lib' folder
],
)
java_binary(
name = "yosql",
deps = [
":yosql_tooling_cli",
],
main_class = "wtf.metio.yosql.tooling.cli.YoSQL",
)
persistence
)project/
├── WORKSPACE
├── BUILD
└── persistence/
└── user/
├── findUser.sql
└── addUser.sql
└── item/
├── queryAllItems.sql
└── createItemTable.sql
filegroup(
name = "your-sql-files",
srcs = glob(["persistence/**/*.sql"]),
)
java_binary
:genrule(
name = "your-repositories",
srcs = [":your-sql-files"],
outs = [
"com/example/persistence/UserRepository.java",
"com/example/persistence/ItemRepository.java",
... all of your generated code
],
cmd = """
$(location :yosql) generate
""",
tools = [":yosql"],
)
srcs
of another rule.YoSQL
CLI tooling follow these steps:
yosql-tooling-cli
zip file from the latest release (or any prior version).bin/yosql
(or bin/yosql.bat
on Windows) on your PATH..sql
files in a directory of your choice (e.g. /path/to/your/sql/files
).yosql --inputBaseDirectory /path/to/your/sql/files
.YoSQL
in their builds. The following steps show how a basic setup looks like. In case you are looking for more details, check out the configuration section further down below.
build.gradle(.kts)
file as describe in the Gradle plugin portal.src/main/yosql
and write SQL statements into them. Take a look at the various options to structure your SQL files.
<project_root>/
├── build.gradle.kts
├── settings.gradle.kts
└── src/
└── main/
└── yosql/
└── domainObject/
├── queryData.sql
└── changeYourData.sql
└── aggregateRoot/
├── findRoot.sql
└── addData.sql
yosql
task (or just run gradle build
) to generate the Java code.Note: The YoSQL Gradle plugin will automatically add the generated sources to the main source set as defined by the Gradle Java plugin. If your project is not using the Java plugin, you have to configure the outputBaseDirectory to be part of a source sets of your project yourself.
You can configure how YoSQL operates and how the generated code looks like by using the yosql
task extension. Take a look at the available configuration options in order to see what can be configured.
yosql-tooling-maven
plugin to use YoSQL
in their builds. The following steps show how a basic setup looks like. In case you are looking for more details, check out the configuration section further down below.
pom.xml
:
<build>
<plugins>
...
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
</plugin>
...
</plugins>
</build>
src/main/yosql
and write SQL statements into them. Take a look at the various options to structure your SQL files.
<project_root>/
├── pom.xml
└── src/
└── main/
└── yosql/
└── domainObject/
├── queryData.sql
└── changeYourData.sql
└── aggregateRoot/
├── findRoot.sql
└── addData.sql
yosql:generate
goal (or just run mvn generate-sources
) to generate the Java code.As an optional and final step to complete the setup of YoSQL
, you can add the build-helper-maven-plugin to your build in order to mark the outputBaseDirectory as a source directory in your IDE like this:
<build>
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/yosql</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
You can configure how YoSQL operates and how the generated code looks like by using the default Maven configuration mechanism. Take a look at the available configuration options in order to see what can be configured.
<build>
<plugins>
...
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<configOption>configValue</configOption>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
The generate
goal binds itself automatically to the generate-sources
phase. In case you want to run it in another phase, change the above example accordingly.
In some cases it might be preferable to generate some repositories with a specific set of configuration options while using another set for other repositories. There are several ways how this can be accomplished:
execution
configurations.execution
sMake sure that multiple executions do not make use of the same .sql files. Otherwise, the executions will overwrite
the generated code of each other. The last execution will win. Share configuration across all executions by using a single top level configuration
block.
<build>
<plugins>
...
<plugin>
<groupId>wtf.metio.yosql</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2023.2.22</version>
<configuration>
<repositories>
<basePackageName>your.domain.persistence</basePackageName>
</repositories>
</configuration>
<executions>
<execution>
<id>config-a</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<files>
<inputBaseDirectory>src/main/database/reactive</inputBaseDirectory>
</files>
</configuration>
</execution>
<execution>
<id>config-b</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<files>
<inputBaseDirectory>src/main/database/synchronous</inputBaseDirectory>
</files>
<repositories>
<apiVersion>16</apiVersion>
</repositories>
</configuration>
</execution>
</executions>
</plugin>
...
</plugins>
</build>