Last active
November 14, 2024 03:47
-
-
Save Eng-Fouad/7b5925481dd391fcc74487a68484b987 to your computer and use it in GitHub Desktop.
Using JDBI in Quarkus (native mode) [JDBI 3.38.2]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
quarkus.native.additional-build-args=-H:ReflectionConfigurationFiles=reflection-config.json,-H:DynamicProxyConfigurationFiles=proxy-config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ "interfaces": [ "io.fouad.demo.db.UserDao" ] }, | |
{ "interfaces": [ "io.fouad.demo.db.FooDao" ] } | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{"name":"org.jdbi.v3.core.statement.SqlStatements","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.statement.StatementExceptions","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.argument.Arguments","methods":[{"name":"<init>","parameterTypes":["org.jdbi.v3.core.config.ConfigRegistry"]}]}, | |
{"name":"org.jdbi.v3.core.mapper.RowMappers","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.mapper.ColumnMappers","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.mapper.Mappers","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.mapper.MapMappers","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.mapper.MapEntryMappers","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.mapper.reflect.ReflectionMappers","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.mapper.reflect.internal.PojoTypes","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.collector.JdbiCollectors","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.qualifier.Qualifiers","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.result.ResultProducers","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.array.SqlArrayTypes","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.transaction.SerializableTransactionRunner$Configuration","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.extension.Extensions","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.internal.OnDemandExtensions","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.internal.EnumStrategies","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.config.internal.ConfigCaches","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.enums.Enums","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.core.Handles","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.sqlobject.Handlers","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.sqlobject.HandlerDecorators","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.sqlobject.SqlObjects","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.sqlobject.SqlObject","methods":[{"name":"getHandle"}]}, | |
{"name":"org.jdbi.v3.sqlobject.config.internal.RegisterRowMapperImpl","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.sqlobject.transaction.internal.TransactionDecorator","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.sqlobject.customizer.TimestampedConfig","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.sqlobject.customizer.internal.BindFactory","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.sqlobject.customizer.internal.BindListFactory","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.sqlobject.statement.internal.SqlObjectStatementConfiguration","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.sqlobject.statement.internal.SqlQueryHandler","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.sqlobject.statement.internal.SqlUpdateHandler","methods":[{"name":"<init>"}]}, | |
{"name":"org.jdbi.v3.postgres.PostgresTypes","methods":[{"name":"<init>"}]} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.fouad.demo.db; | |
public interface UserDao { | |
@SqlUpdate("CREATE TABLE user (id INTEGER PRIMARY KEY, name VARCHAR)") | |
void createTable(); | |
@SqlUpdate("INSERT INTO user(id, name) VALUES (?, ?)") | |
void insertPositional(int id, String name); | |
@SqlUpdate("INSERT INTO user(id, name) VALUES (:id, :name)") | |
void insertNamed(@Bind("id") int id, @Bind("name") String name); | |
@SqlUpdate("INSERT INTO user(id, name) VALUES (:id, :name)") | |
void insertBean(@BindBean User user); | |
@SqlQuery("SELECT * FROM user ORDER BY name") | |
@RegisterBeanMapper(User.class) | |
List<User> listUsers(); | |
} |
Include the following classes always, if org.jdbi:jdbi3-sqlobject
artifact is used and jdbi.installPlugin(new SqlObjectPlugin())
is invoked:
{"name":"org.jdbi.v3.core.internal.OnDemandExtensions","methods":[{"name":"<init>"}]},
{"name":"org.jdbi.v3.sqlobject.statement.internal.SqlObjectStatementConfiguration","methods":[{"name":"<init>"}]},
{"name":"org.jdbi.v3.sqlobject.Handlers","methods":[{"name":"<init>"}]},
{"name":"org.jdbi.v3.sqlobject.HandlerDecorators","methods":[{"name":"<init>"}]},
{"name":"org.jdbi.v3.sqlobject.SqlObject","methods":[{"name":"getHandle"}]},
Include the following class, only if annotation @org.jdbi.v3.sqlobject.customizer.Timestamped
is used:
{"name":"org.jdbi.v3.sqlobject.customizer.TimestampedConfig","methods":[{"name":"<init>"}]},
Include the following class, only if one of the annotations that follows is used:
{"name":"org.jdbi.v3.sqlobject.SqlObjects","methods":[{"name":"<init>"}]},
@org.jdbi.v3.sqlobject.locator.UseAnnotationSqlLocator
@org.jdbi.v3.sqlobject.locator.UseClasspathSqlLocator
@org.jdbi.v3.sqlobject.statement.SqlBatch
@org.jdbi.v3.sqlobject.statement.SqlCall
@org.jdbi.v3.sqlobject.statement.SqlQuery
@org.jdbi.v3.sqlobject.statement.SqlScripts
@org.jdbi.v3.sqlobject.statement.SqlUpdate
Include the following class always, if org.jdbi:jdbi3-postgres
artifact is used and jdbi.installPlugin(new PostgresPlugin())
is invoked:
{"name":"org.jdbi.v3.postgres.PostgresTypes","methods":[{"name":"<init>"}]},
The following classes I am not sure when to include them:
{"name":"org.jdbi.v3.core.mapper.MapMappers","methods":[{"name":"<init>"}]},
{"name":"org.jdbi.v3.core.mapper.MapEntryMappers","methods":[{"name":"<init>"}]},
{"name":"org.jdbi.v3.core.mapper.reflect.ReflectionMappers","methods":[{"name":"<init>"}]},
{"name":"org.jdbi.v3.core.mapper.reflect.internal.PojoTypes","methods":[{"name":"<init>"}]},
{"name":"org.jdbi.v3.core.qualifier.Qualifiers","methods":[{"name":"<init>"}]},
To be in safe side, just include them all.
Include the following class, if Immutables is used:
{"name":"org.jdbi.v3.core.mapper.immutables.JdbiImmutables","methods":[{"name":"<init>"}]},
Include the following class, if FreeBuilders is used:
{"name":"org.jdbi.v3.core.mapper.freebuilder.JdbiFreeBuilders","methods":[{"name":"<init>"}]},
I didn't test the other modules that Jdbi already supports:
jdbi3-guava
Support for Guava’s collection and Optional types.
jdbi3-jodatime2
Support for JodaTime v2’s DateTime type.
jdbi3-jpa
Minimal support for JPA annotations.
jdbi3-kotlin
Automatically map kotlin data classes.
jdbi3-kotlin-sqlobject
Enhance the SQL Object extension to support Kotlin default methods and method default parameters.
jdbi3-oracle12
Support Oracle returning DML statements.
jdbi3-spring5
Provides a factory bean to set up Jdbi singleton.
jdbi3-stringtemplate4
Use the StringTemplate4 template engine, instead of JDBI’s built in engine.
jdbi3-vavr
Support for Vavr Tuples, Collections and Value arguments
great write up.
great works
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Include the following classes always, if
org.jdbi:jdbi3-core
artifact is used (all the time):Note: Include other Caffeine classes, only if the constructors
ColonPrefixSqlParser(Caffeine<Object, Object> cache)
orHashPrefixSqlParser(final Caffeine<Object, Object> cache)
with customizedCaffeine
object is invoked. The cache classes are incom.github.benmanes.caffeine.cache.*
package with class name all capitalized.Include the following class, when result set is returned (almost all time):
Include the following class, if
Jdbi.onDemand(java.lang.Class)
is invoked:Include the following class, when arrays are used:
Include the following classes, when enums are used:
Include the following class, when transactions are used:
Include the following class, when extensions (e.g. UserDao class) are used: