Have you checked out MyBatis or JOOQ? They sound pretty much like what you're describing.
Think about it more like MyBatis meets Spring Data JPA. Define that entity in XML the run a code gen which gives you the CrudRepository class but also generates a controller that exposes an API with pretty good good ability to specify adhoc queries. Plus view models.
I think it worked because it both reasonably well designed and hyper opinionated.