Consider a StatelessSession variant of the SimpleJpaRepository and AOT support
At the moment the SimpleJpaRepository and generated AOT repositories all use the default EntityManager factory. As a user of Spring Data JPA I would like to have the option to be able to switch to the Hibernate StatelessSession instead of the default stateful EntityManager.
At the moment the only option to do so is to write everything yourself (or only for selected usecases).
It would be nice if there was an option (globally or per method) to indicate that this should use a StatelessSession or regular EntityManager. I'm aware that this would, probably, be a Hibernate only implementation as I"m not aware of existing/similair support in other JPA frameworks.
StatelessSession is currently a Hibernate-only concept. Chances stand well that the stateless-session concept will be included in the JPA 4.0 spec giving us an opportunity to explore a stateless repository implementation.
Zooming out, what benefits do you get from using a stateless session? Hibernate's stateless session is stateful during query execution and once the query returns objects, then objects get detached.