Persistence APIs

YoSQL supports multiple persistence APIs to interact with a database. We recommend that you pick the one that is already available in your project. In case you are starting fresh, YoSQL will default to the JDBC implementation because it requires no external dependencies and thus your project should be able to compile the generated code just fine. Some YoSQL tooling like the Maven plugin might auto-detect certain settings in your project to make your life easier, however you are always in full control and can change very aspect of the generated code.

Take a look at the available configuration options to adapt the generated code according to your needs. In order to monitor execution of your SQL statements, we recommend enabling one of the supported logging APIs to add log output to the generated code. Read the SQL section to learn how to write SQL statements in a YoSQL-enabled project.

Tooling

Replace configValue with the constant value for whatever persistence API you want to use in the generated code.

Maven

In order to use YoSQL together with Maven, take a look at the tooling documentation for Maven.

<build>
    <plugins>
        ...
        <plugin>
            <groupId>wtf.metio.yosql</groupId>
            <artifactId>yosql-tooling-maven</artifactId>
            <version>2021.4.21</version>
            <configuration>
                <apis>
                    <daoApi>configValue</daoApi>
                </apis>
            </configuration>
        </plugin>
        ...
    </plugins>
</build>

Gradle

In order to use YoSQL together with Gradle, take a look at the tooling documentation for Gradle.

plugins {
  id("wtf.metio.yosql")
}

yosql {
  apis {
    daoApi = configValue
  }
}

Bazel

In order to use YoSQL together with Bazel, take a look at the tooling documentation for Bazel.

CLI

In order to use YoSQL on the command line, take a look at the tooling documentation for CLI.

$ yosql --apis-dao-api=configValue

The shorter form is available as well:

$ yosql --dao-api=configValue

Pages