jdbi icon indicating copy to clipboard operation
jdbi copied to clipboard

@ColumnName usage together with JdbiImmutables

Open FuoriDiTesta opened this issue 5 years ago • 1 comments

Hi,

i'm trying to use JDBI together with classes generated with Immutables annotation (@Value.Immutable). The initialization of JDBI class is the following:

Jdbi jdbi = Jdbi.create(dataSource).installPlugin(new SqlObjectPlugin()); jdbigetConfig(JdbiImmutables.class).registerImmutable(Descriptor.class);

Descriptor class instead is

@Value.Style(allParameters = true, passAnnotations = { ColumnName.class }) @Value.Immutable public abstract class Descriptor { @ColumnName("DB_FIELD_NAME") abstract public String getName(); }

I'm not able to make if work, if i use the ColumnName annotation (i have parameters in the query that is different from the parameters name). The error i get is

_java.lang.IllegalArgumentException: Failed to find builder setter for property DB_FIELD_NAME on class ImmutableDescriptor$Builder at org.jdbi.v3.core.mapper.reflect.internal.ImmutablesPropertiesFactory$ImmutablePojoProperties.findBuilderSetter(ImmutablesPropertiesFactory.java:171) ... _

I try to search but i haven't found a way to resolve this problem. Hope you can help me.

Thanks!

FuoriDiTesta avatar Sep 18 '20 14:09 FuoriDiTesta

Hi, this seems to be against an older version of Jdbi. Can you confirm that the issue still exists on the latest, or tell us what version you use? I think the issue might already be fixed. Thanks.

stevenschlansker avatar Oct 16 '20 01:10 stevenschlansker