You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java.lang.UnsupportedOperationException: Must use a concretely typed RowMapper here
at org.jdbi.v3.core.mapper.InferredRowMapperFactory.lambda$new$0(InferredRowMapperFactory.java:38)
at java.base/java.util.Optional.orElseThrow(Optional.java:385)
at org.jdbi.v3.core.mapper.InferredRowMapperFactory.<init>(InferredRowMapperFactory.java:38)
at org.jdbi.v3.core.mapper.RowMappers.register(RowMappers.java:63)
at org.jdbi.v3.core.config.Configurable.lambda$registerRowMapper$16(Configurable.java:248)
at org.jdbi.v3.core.config.Configurable.configure(Configurable.java:74)
at org.jdbi.v3.core.config.Configurable.registerRowMapper(Configurable.java:248)
at ...
One thing to note: registering a row mapper and then calling mapTo(type) is wasted effort if that mapper is not being reused anywhere else. You could just call the map(RowMapper<T>) method and pass the lambda directly to that:
As a follow up: when you create an anonymous inner class, you are creating a concretely typed mapper.
What we mean by concretely typed is that Jdbi can get the mapper's class and reflectively discover the generic parameter T for RowMapper<T>. Whether you do this via a full-fledged class like class FooMapper implements RowMapper<Foo> { ... } or via an anonymous inner class e.g. new RowMapper<Foo>() { ... }, it looks the same to Jdbi.
First of all: Thanks for this awesome library! We are slowly migrating from Hibernate to jdbi and are very satisfied with it so far ;)
Suppose I have the following code:
When registering the RowMapper as shown I get
but when using
instead everything works fine.
I thought lambdas were only syntactic sugar and the compiler would expand the code anyway?
The text was updated successfully, but these errors were encountered: