micronaut-projects / micronaut-projects/micronaut-sql

Micronaut SQL Hibernate Maven fails with Could not obtain transaction-synchronized Session for current thread

Open
#1,156 9 comments 0 reactions 2 assignees Claimed by @graemerocher View on GitHub
status: in progress type: bug
Dominant language
Java
Stars
83
Forks
49
Avg merge
1d 10h
Merged PRs (30d)
22

Description

## Steps to reproduce:

clone https://github.com/grails-core-issues-forks/micronaut-sql-1156

```
cd ../micronaut-jpa-hibernate-maven-java
./mvnw verify
```

You will get:

```
18:50:44.274 [io-executor-thread-1] ERROR i.m.http.server.RouteExecutor - Unexpected error occurred: Could not obtain transaction-synchronized Session for current thread
org.hibernate.HibernateException: Could not obtain transaction-synchronized Session for current thread
at io.micronaut.transaction.hibernate.MicronautSessionContext.currentSession(MicronautSessionContext.java:61)
at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:599)
at io.micronaut.configuration.hibernate.jpa.TransactionalSessionInterceptor.intercept(TransactionalSessionInterceptor.java:62)
at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
at io.micronaut.configuration.hibernate.jpa.TransactionalSession$Intercepted.persist(Unknown Source)
at example.micronaut.GenreRepositoryImpl.save(GenreRepositoryImpl.java:40)

```

The same application works with Gradle.

```
cd micronaut-jpa-hibernate-gradle-java
./gradlew test
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.