Skip to content

Tag: jdbi

NoSuchMethodException in JDBI while using it with Lombok

I has immutable class like: JDBI Developer Guide states that it should work with @Value annotations. At least with bindBean() or @BindBean. But when I use org.jdbi.v3.core.result.ResultBearing#mapToBean method with MyEntry.class it throws java.lang.NoSuchMethodException: no such constructor: my.company.MyEntr…

Use BeanMapper from within a RowMapper?

I’m using JDBI’s SQL Objects declarative API to map an object containing a one-to-many relationship: Initially it looked like a RowReducer would be ideal: However I soon discovered that RowReducers don’t work with ResultIterators (I’m working with a large database so it’s importa…

A way to bind Java Map to sql varchar in JDBI INSERT statement

Is there a way to bind a java Map<String, Object> to a varchar in the the JDBI @BindBean annotation. So for example I have a class Something.class and I create a @SqlBatch(“INSERT INTO Something (name, payload) VALUES(:name, :payload)”). Now in my java class the name is of type String and pa…

Use a list of strings in IN clause with JDBI

I’m using JDBI / Dropwizard for a project and would like to run some simple queries. I have a query like so: private static final String GET_STUFF = “SELECT * FROM myTable WHERE state IN (:desiredState)” I bind the variable in my method like so: However, I get the following error when runnin…

What is the difference between JDBC and JDBI?

I want to know about the differences between JDBC and JDBI in java. In particular, which one is generally better and why? Answer (I am the primary author of jDBI) jDBI is a convenience library built on top of JDBC. JDBC works very well but generally seems to optimize for the database vendors (driver writers) …