Skip to content
Advertisement

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.MyEntry.<init>()void/newInvokeSpecial. Looks like it trying create object with empty constructor and set fields after it. But I want to let my class be immutable.

Are all exceptions throw from Jdbi of type JdbiException?

It states here: https://jdbi.org/apidocs/org/jdbi/v3/core/JdbiException.html that JdbiException is the Base unchecked exception for exceptions thrown from jdbi. However, if I’m calling the withHandle method with various different callbacks: the docs state that it throws X extends Exception (rather than throwing JdbiExecption as I would have expected) and describes it as @param <X> exception type thrown by the callback, if any.: I

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 important to be able to stream these) so now I’m reverting back to implementing a RowMapper instead. I’d

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 payload is of type Map<String, Object> and I want in

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 running: I’m passing in states as an ArrayList

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) over the users. jDBI attempts

Advertisement