Skip to content

Instantly share code, notes, and snippets.

@Eng-Fouad
Last active November 14, 2024 03:47
Show Gist options
  • Save Eng-Fouad/7b5925481dd391fcc74487a68484b987 to your computer and use it in GitHub Desktop.
Save Eng-Fouad/7b5925481dd391fcc74487a68484b987 to your computer and use it in GitHub Desktop.
Using JDBI in Quarkus (native mode) [JDBI 3.38.2]
quarkus.native.additional-build-args=-H:ReflectionConfigurationFiles=reflection-config.json,-H:DynamicProxyConfigurationFiles=proxy-config.json
[
{ "interfaces": [ "io.fouad.demo.db.UserDao" ] },
{ "interfaces": [ "io.fouad.demo.db.FooDao" ] }
]
[
{"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>"}]}
]
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();
}
@Eng-Fouad
Copy link
Author

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

@smil2k
Copy link

smil2k commented Jul 26, 2022

great write up.

@thegenius
Copy link

great works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment