mercredi 16 octobre 2019

JDBI using Inner Classes

I have a POJO that contains an inner (non-static) class as it shared the parents id

public Long getId() {
   return Parent.this.getId();
}

Now I am trying to map these in JDBI but it appears that JDBI cannot instaniate the inner class?

    Caused by: java.lang.InstantiationException: com.xxxx.Parent$Child
    at java.lang.Class.newInstance(Class.java:427)
    at org.jdbi.v3.core.mapper.reflect.FieldMapper.construct(FieldMapper.java:214)
    ... 38 more
Caused by: java.lang.NoSuchMethodException: com.xxxx.Parent$Child.<init>()
    at java.lang.Class.getConstructor0(Class.java:3082)
    at java.lang.Class.newInstance(Class.java:412)
    ... 39 more

My experience with inner classes is sadly lacking - what am I missing here? Or is this simply a deficiency in the JDBI library?





Aucun commentaire:

Enregistrer un commentaire