THIS REPOSITORY IS NOW FROZEN.
The new version is here: https://github.com/quarkiverse/quarkiverse-doma
Quarkus Extension for Doma provides the following features:
- Hot reloading
- Automatic bean register
- Automatic SQL execution on startup
- Configuration
- Multiple Datasources
- Support for native images
In development mode, SQL and Script files are hot reloaded.
Our extension registers all DAO beans to the Quarkus CDI container automatically.
Our extension executes import.sql
automatically when Doma starts.
You can write the following configurations in your application.properties file:
quarkus.doma.sql-file-repository=greedy-cache
quarkus.doma.naming=none
quarkus.doma.exception-sql-log-type=none
quarkus.doma.dialect=h2
quarkus.doma.batch-size=10
quarkus.doma.fetch-size=50
quarkus.doma.max-rows=500
quarkus.doma.query-timeout=5000
quarkus.doma.sql-load-script=import.sql
The above properties are all optional.
See quarkus-doma.adoc for more details.
You can bind Doma's configurations to each datasource as follows:
# default datasource
quarkus.datasource.db-kind=h2
quarkus.datasource.username=username-default
quarkus.datasource.jdbc.url=jdbc:h2:tcp://localhost/mem:default
quarkus.datasource.jdbc.min-size=3
quarkus.datasource.jdbc.max-size=13
# inventory datasource
quarkus.datasource.inventory.db-kind=h2
quarkus.datasource.inventory.username=username2
quarkus.datasource.inventory.jdbc.url=jdbc:h2:tcp://localhost/mem:inventory
quarkus.datasource.inventory.jdbc.min-size=2
quarkus.datasource.inventory.jdbc.max-size=12
# Doma's configuration bound to the above default datasource
quarkus.doma.dialect=h2
quarkus.doma.batch-size=10
quarkus.doma.fetch-size=50
quarkus.doma.max-rows=500
quarkus.doma.query-timeout=5000
quarkus.doma.sql-load-script=import.sql
# Doma's configuration bound to the above inventory datasource
quarkus.doma.inventory.dialect=h2
quarkus.doma.inventory.batch-size=10
quarkus.doma.inventory.fetch-size=50
quarkus.doma.inventory.max-rows=500
quarkus.doma.inventory.query-timeout=5000
quarkus.doma.inventory.sql-load-script=import.sql
You can inject the named Doma's resource
using the io.quarkus.agroal.DataSource
qualifier as follows:
@Inejct
Config defaultConfig;
@Inejct
Entityql defaultEntityql;
@Inejct
NativeSql defaultNativeSql;
@Inejct
@DataSource("inventory")
Config invetoryConfig;
@Inejct
@DataSource("inventory")
Entityql inventoryEntityql;
@Inejct
@DataSource("inventory")
NativeSql inventoryNativeSql;
Our extension recognizes reflective classes and resources, and includes them into your native image without additional configurations.
Quarkus supports Java 8 or Java 11+ but Quarkus Extension for Doma requires Java 11+.
dependencies {
annotationProcessor "org.seasar.doma:doma-processor:2.44.0"
implementation "org.seasar.doma:doma-core:2.44.0"
implementation "org.seasar.doma:doma-quarkus-deployment:1.1.0"
}
...
<properties>
<org.seasar.doma.version>2.44.0</org.seasar.doma.version>
<org.seasar.doma-quarkus.version>1.1.0</org.seasar.doma-quarkus.version>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
</properties>
...
<dependencies>
<dependency>
<groupId>org.seasar.doma</groupId>
<artifactId>doma-core</artifactId>
<version>${org.seasar.doma.version}</version>
</dependency>
<dependency>
<groupId>org.seasar.doma</groupId>
<artifactId>doma-quarkus-deployment</artifactId>
<version>${org.seasar.doma-quarkus.version}</version>
</dependency>
</dependencies>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
<configuration>
<source>11</source>
<target>11</target>
<!-- the parameters=true option is critical so that RESTEasy works fine -->
<parameters>true</parameters>
<annotationProcessorPaths>
<path>
<groupId>org.seasar.doma</groupId>
<artifactId>doma-processor</artifactId>
<version>${doma.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>