DEV Community

Discussion on: You Can Do it in SQL, Stop Writing Extra Code for it

Collapse
 
seimic profile image
seimic

one way is to compose the orm representation of the data from the raw table and lazy loaded views mapped readonly. In case of JPA this means @SecondaryTable pointing to a View and columns with insertable=false, updatable=false. by this they never appear in any insert or update statement and the additional aggregation logic is cleanly separated from the raw data model. works fine.