Spring Boot cannot build its EntityManagerFactory proxy around Hibernate's SessionFactory
Your error
java.lang.IllegalStateException: EntityManagerFactory interface [interface org.hibernate.SessionFactory] seems to conflict with Spring's EntityManagerFactoryInfo mixin - consider resetting the 'entityManagerFactoryInterface' property to plain [jakarta.persistence.EntityManagerFactory]1 more line it can showFix it fast
Most common cause, 1 of 3The build raises the JPA API to 3.2 on a Boot 3 project
Delete the override and let Boot choose the JPA API.
<!-- pom.xml: remove these lines -->
<properties>
<jakarta-persistence.version>3.2.0</jakarta-persistence.version>
</properties>
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>3.2.0</version>
</dependency>Short answer
EntityManagerFactory interface [org.hibernate.SessionFactory] seems to conflict with Spring's EntityManagerFactoryInfo mixin appears when jakarta.persistence-api 3.2 sits next to Hibernate 6: both declare getSchemaManager() with different return types. On Spring Boot 3.x keep the managed JPA 3.1.0; if you need JPA 3.2, move to Boot 4.x, which pairs it with Hibernate 7.4.
Which cause do you have?
Print the versions of the JPA API jar and of hibernate-core that the app really runs with. Hibernate 6 with jakarta.persistence-api 3.2 is the broken pair; the next question is only how 3.2 got in.
# Maven
mvn dependency:tree -Dincludes=jakarta.persistence
mvn dependency:tree -Dincludes=org.hibernate.orm
# Gradle
./gradlew -q dependencyInsight --dependency jakarta.persistence-api --configuration runtimeClasspathThen find the line you see in this list and open its fix:
- 1The build raises the JPA API to 3.2 on a Boot 3 project
pom.xml or build.gradle sets jakarta-persistence.version, or declares jakarta.persistence-api with its own version, and the tree shows 3.2.x beside hibernate-core 6.x - 2A library pulls in JPA 3.2 and Gradle's platform lets it win
Your build has no JPA override, the project imports the Boot BOM with platform(), and dependencyInsight names another library as the one that requested 3.2 - 3A plain Spring project without the Boot BOM picks up 3.2 by nearest definition
There is no Spring Boot parent or BOM, and the Maven tree reaches jakarta.persistence-api 3.2 through a library that is closer to your project than hibernate-core
What does the error look like?
java.lang.IllegalStateException: EntityManagerFactory interface [interface org.hibernate.SessionFactory] seems to conflict with Spring's EntityManagerFactoryInfo mixin - consider resetting the 'entityManagerFactoryInterface' property to plain [jakarta.persistence.EntityManagerFactory]Caused by: java.lang.IllegalArgumentException: methods with same signature getSchemaManager() but incompatible return types: [interface org.hibernate.relational.SchemaManager, interface jakarta.persistence.SchemaManager]
Cause 1 of 3
The build raises the JPA API to 3.2 on a Boot 3 project
You seepom.xml or build.gradle sets jakarta-persistence.version, or declares jakarta.persistence-api with its own version, and the tree shows 3.2.x beside hibernate-core 6.x
Check
Boot 3.5.12 manages JPA 3.1.0 with Hibernate 6.6.44. When the build forces the 3.2 API, Spring tries to create a proxy that implements both Hibernate's SessionFactory and JPA's EntityManagerFactory, and the two getSchemaManager() methods cannot live in one proxy. In the Boot issue, a Spring Framework maintainer traced the clash to Hibernate's own interface, so resetting entityManagerFactoryInterface as the message suggests only moves the failure further down.
grep -nE "jakarta-persistence.version|jakarta.persistence-api" pom.xml build.gradleFix
Delete the override and let Boot choose the JPA API. If your code truly needs JPA 3.2, upgrade to Boot 4.x instead, where the managed Hibernate is a 7.x release built for that API.
<!-- pom.xml: remove these lines -->
<properties>
<jakarta-persistence.version>3.2.0</jakarta-persistence.version>
</properties>
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>3.2.0</version>
</dependency>Verify
The tree shows jakarta.persistence-api 3.1.0 on Boot 3.5, the application context starts, and repositories load.
mvn dependency:tree -Dincludes=jakarta.persistenceConfirmed by github.com
Cause 2 of 3
A library pulls in JPA 3.2 and Gradle's platform lets it win
You seeYour build has no JPA override, the project imports the Boot BOM with platform(), and dependencyInsight names another library as the one that requested 3.2
Check
With Gradle's own BOM support, a platform dependency only recommends versions. Any other request in the graph can lift jakarta.persistence-api above the 3.1.0 that Boot 3.5 expects, and Boot's version properties have no effect in that setup.
./gradlew -q dependencyInsight --dependency jakarta.persistence-api --configuration runtimeClasspathFix
Make Boot's versions binding with enforcedPlatform, or pin the group with a resolution strategy as Boot's Gradle guide shows. If the library cannot run on JPA 3.1, choose its previous release or move the app to Boot 4.x.
dependencies {
implementation enforcedPlatform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
}
// or pin only the JPA API group
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'jakarta.persistence') {
details.useVersion '3.1.0'
}
}
}Verify
dependencyInsight reports 3.1.0 as the selected version, and bootRun reaches the started message.
./gradlew bootRunConfirmed by docs.spring.io
Cause 3 of 3
A plain Spring project without the Boot BOM picks up 3.2 by nearest definition
You seeThere is no Spring Boot parent or BOM, and the Maven tree reaches jakarta.persistence-api 3.2 through a library that is closer to your project than hibernate-core
Check
Maven keeps the version found nearest to your project in the dependency tree. A library declared directly can therefore drag in the newer JPA API ahead of the one hibernate-core 6 was built for. Hibernate's releases page lists the 6.x series with Jakarta Persistence 3.1 and 7.0 with 3.2.
mvn dependency:tree -Dverbose -Dincludes=jakarta.persistenceFix
Pin the API in your own dependencyManagement block. Maven applies that version to transitive copies as well, which overrides the nearest-definition choice.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>3.1.0</version>
</dependency>
</dependencies>
</dependencyManagement>Verify
A single jakarta.persistence-api 3.1.0 is left in the tree and the LocalContainerEntityManagerFactoryBean initialises.
mvn dependency:tree -Dincludes=jakarta.persistenceConfirmed by maven.apache.org
How do I stop it coming back?
- Treat jakarta.persistence-api and hibernate-core as one pair: change both only through a Boot version bump.
- Run dependencyInsight for jakarta.persistence-api in CI after adding any persistence-related library, and fail if it reports a different version than Boot manages.
- Check Hibernate's releases page before an upgrade; each series lists the Jakarta Persistence version it implements.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine on the same stack: QistLock, Dispatch Pro, Nuclear Home Video.