Mapping query result to a plain java bean with @SqlResultSetMapping
Jan 31, 2018
I needed some data from a old big oracle database. Most of the time I write or generate a entity class, and fetch the data with a Named Query. But this time I only needed two informations and I didn’t what to use a dozen primary keys and so on to find it. So I used a Native Query.. I know… messy.
Trying to make it look a little professional, I used a SqlResultSetMapping to map the result to a plain old java bean.