RowMappers for same Type but different prefixes

9 views
Skip to first unread message

Ralf Eichinger

unread,
Feb 16, 2021, 6:45:12 AM2/16/21
to jDBI

we are in need of mapping columns of a resultset based on prefix to pojos.

Our select returns values/columns for an Image pojo (prefixed "fr" (for fileresource))
but (over join) also values/columns for a preview image pojo of this image (prefixed "pi" (for previewimage)). we registered rowmappers for Image twise : with different prefix each.

but as your documentation states: the first in list of mappers (we registered two for Image.class: one with prefix "fr" and another one with prefix "pi") takes precedence and so only one of the two images gets filled with values.

It would be very convenient, if there would be something like

rowView.getRow("pi", Image.class)

to specifiy which prefixed columns should be used for mapping into pojo (by getting the rowmapper from configured rowmappers that matches type AND prefix).

What do you think about it?
rowView.getRow(Image.class) could work unchanged (taking the first)

Reply all
Reply to author
Forward
0 new messages