This content has been marked as final. Show 2 replies
MVC pattern assumes that you want to separate business logic and view logic - the business logic would happen in the controller classes. Database operations are part of business logic, so they too would happen in the controller classes too. It isn't that difficult really.
You should try to keep high level concepts (MVC) and low level concepts (database operations) separate to avoid confusion.
You can actually use MVC implementations and persist directly to a database. Depending the project requirements, and for seperation of concerns, it is dough better to provide a different layer in your business logic handling persistency related concerns.
Many tutorials on the web provide a straight way to persist data to a database from within your MVC, but when you're handling with a big project, you should better your JPA in your business layer and provide a facade on your entity which you can access from your MVC (front) implementation.