how to save simple CRUD codes in a service, just like GenericDao/JpaRepository?
问题 Our web project uses spring3, Jpa (hibernate). To save CRUD and other commonly used methods, we made our repositories sub-classes of spring JpaRepository. Sometimes I just injected repositories to Controller, it is convenient for those simple (or none) business logic read-only data access. e.g. list all objects of an entity type in view... I knew that all these should be done in a service layer with transaction scope, but it is really convenient. Now comes a rule: controller layer must via