Questions tagged [jdbi3]

49 questions
7
votes
1 answer

Spring Boot Custom Bean Loader

I am using JDBI in tandem with Spring Boot. I followed this guide which results in having to create a class: JdbiConfig in which, for every dao wanted in the application context, you must add: @Bean public SomeDao someDao(Jdbi jdbi) { return…
JDrost1818
  • 1,116
  • 1
  • 6
  • 23
6
votes
2 answers

Mapping @Json property with JDBI

According to JDBI document https://jdbi.org/#_jackson_2, it seems that it's quite straight forward to have a json property of your object model, however I've tried the following and it ran into many issues. DB: Postgres with a column type of…
Tin Ng
  • 937
  • 2
  • 11
  • 25
2
votes
1 answer

Does Jdbi3 guarantee rollback on transaction for every type of Exception?

I have a code like this one: jdbi.inTransaction(h -> { Dao1 dao1 = h.attach(Dao1.class); if(!dao1.somequery()) { throw new CustomException("foobar"); } …
res1
  • 3,482
  • 5
  • 29
  • 50
2
votes
2 answers

JDBI erro No mapper registered for type

I'm trying to create a method that return all users from customer table in my database but this code: try { List customer = jdbi.open().createQuery("SELECT * FROM customer") .mapTo(Customer.class).list(); } catch…
Igor Vinicius
  • 111
  • 1
  • 9
2
votes
1 answer

JDBI 3: Nested SQLObject

I try to gather compounded objects with jdbi 3 which are stored in connected tables. The entities event 1 -> n author are an example for the data structure. They are connected via author_id which is saved in a column in event. They were easily…
BeJay
  • 425
  • 4
  • 15
2
votes
0 answers

Quarkus with JDBI

I'am using quarkus with JDBI. Is there any equivalent to Spring's class TransactionAwareDataSourceProxy.class which will wrap DataSource forcing JDBI to get an existinga Connection associated with the current transaction, when it requests a new…
Igor Vuković
  • 742
  • 12
  • 25
1
vote
1 answer

In Jdbi3, how can I use bindBean() for same field?

I have Java code: String updateSql = "UPDATE table_name SET field_two = :field_two" + " WHERE field_one = :field_one AND field_two <> :field_two"; handle.createUpdate(updateSql) .bindBean(myBean) .execute(); @Data public…
EzyHoo
  • 301
  • 2
  • 14
1
vote
1 answer

Map jdbi query result to a map keyed on a column with a list of values

Imagine a scenario where I am querying the orders table for a list of users and trying to find their orders. I am trying to get a map, with a keyset of user ids, and a list of order objects. return type is similar to this - Map
Gyanendra Singh
  • 895
  • 2
  • 13
  • 30
1
vote
2 answers

JDBI 3 Nested object with lombok

First of all, I already tried this JDBI 3: Nested SQLObject and it didn't work I'm trying basically the same thing as the other person, to gather some nested objects in jdbi 3 but using RegisterConstructorMapper instead. This is my…
Cam Moreira
  • 352
  • 1
  • 4
  • 13
1
vote
1 answer

Jdbi transaction - multiple methods - Resources should be closed

Suppose I want to run two sql queries in a transaction I have code like the below: jdbi.useHandle(handle -> handle.useTransaction(h -> { var id = handle.createUpdate("some query") …
Hurricane
  • 1,454
  • 1
  • 13
  • 31
1
vote
0 answers

Jdbi3 - is it possible creating DB connection to postgresql which hosted on google cloud

I'm trying to setup a db connection using Jdbi3. The DB we have at the moment is PostgreSQL which is hosting on google cloud. From Jdbi3 official doc, I have tried to create the connection with: jdbi =…
Shi Tim
  • 423
  • 2
  • 5
  • 18
1
vote
0 answers

NoSuchMethodException in JDBI while using it with Kotlin

I am trying to use JDBI with PostgreSQL database. I am using Kotlin. Even after trying for several hours, I couldn't get to a point where I can use basic CRUD operations. val users = jdbi.withHandleUnchecked { it .createQuery("select…
nilTheDev
  • 380
  • 3
  • 14
1
vote
1 answer

Jdbi and Inheritance: Conditional Mapping?

I have a single table called Tags that stores a "Tag" as a row, regardless of what specific subclass they represent. Some rows represent modbus tags, some snmp, some other protocols. All classes inheriting from Tag store their data in this one…
TheFunk
  • 981
  • 11
  • 39
1
vote
1 answer

JDBI bindBean fails to find named parameters

I am attempting to update an Employee row in my Employee table using JDBI. However, the bindBean method doesn't appear to like my bean. I have included getters and setters. The bean has a public default constructor. The property names of the object…
TheFunk
  • 981
  • 11
  • 39
1
vote
1 answer

How to use JDBI @Transaction annotation in a non-interface and non-abstract class?

So I come from Spring Boot background and I was really impressed how Spring @Transactional annotation just worked seamlessly along with Hibernate. I am working on a Dropwizard application now that is using Jdbi3. And I have found a similar…
Prince Bansal
  • 1,635
  • 15
  • 24
1
2 3 4