I have made a CRUD as most tutorials. This was working in my opinion good. The database data was manupulated, records added, deleted etc.
My code is refactored and the add record, update record, a 'refresh' is added, with a 'special' repository..., which I do not understand.
Here is the special repository:
Here is my refactored add record method with the refresh call and the colleague note:
I think and expect, that if everything is well coded, the save is updating the database and the
persistence context as well, or..?.
I expect that this is default implemented by Hibernate or...?
(I have asked my colleague who refactored it a few weeks ago on the teams chat. The answer was it is hard to explain in a few words and takes to long... And honestly is must say I have not asked it again)
But now I must do an investigations about CQRS, because the idea was to use this instead of CRUD for a relative simple app.
With this investigation I came across
this webpage:
This is a refresh used to update a materialized view, which I understand if the refresh is therefore used.
I have
test it, and if I execute a new order than the materialized view is updated with totals as well.
My question at the end is, with a simple/normal- straight CRUD - save via the repository, is it required to execute a refresh for update persistence layer?
And are there maybe special cases when you should do that?