re: You Can Do it in SQL, Stop Writing Extra Code for it VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I'm always torn on how to actually implement this advice though. Sure its faster and in some ways easier to use the built in SQL stuff, especially ...
 

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.

code of conduct - report abuse