spring-projects / spring-projects/spring-data-jpa

Consider a StatelessSession variant of the SimpleJpaRepository and AOT support

Open
#4,040 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: enhancement
Dominant language
Java
Stars
3.3k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading SimpleJpaRepository and the generated AOT repositories, then trace how they obtain the default EntityManager factory. Compare the repository and AOT paths to determine where a Hibernate StatelessSession could be selected globally or per method. Done would require a clearly defined configuration model that preserves regular EntityManager behavior and covers both repository variants.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.