This message was deleted.
# spring
s
This message was deleted.
🧵 1
t
I am not sure what
AbstractResourceAssemblerSupport
is (I see you are using spring-hateaos 0.25.0, in 0.25.2 there is a class called
ResourceAssemblerSupport
which seems to do the same), but probably you can override the
instantiateResource
method in your assembler
then you can call your constructor, which you can thus adapt for non-nullable fields
s
Thank you Marco Davi
Just sent the scrernshot of AbstractResourceSupport
@thanksforallthefish
t
same suggestion, override
instantiateResource
calling your constructor directly in
PaymentDetailAssembler
and please, avoid screenshots and thread, it is pointless to spam the whole channel
s
Sure.
Sorry about that
@thanksforallthefish so I could make it work by adding following code snippet
Copy code
override fun instantiateResource(entity: PaymentDetailDao): PaymentDetail {
        return PaymentDetail(externalPaymentId = -1)
    }
I made externalPaymentId nullable. But I am now assigning a default value to the field , which does not make sense.
@thanksforallthefish am I missing something?
t
you have entity to populate from, like
return PaymentDetail(externalPaymentId = entity.externalId)
. if all fields are nullable you have to fallback to defaults though.
s
Gotcha. Thank you so much!