Skip to content

quarkus-hibernate-reactive does not make StatelessSession available for injection #47462

@gavinking

Description

@gavinking

Description

The regular quarkus-hibernate-orm extension makes a Hibernate StatelessSession available for injection, which means that Jakarta Data repositories can be easily injected in user code.

But quarkus-hibernate-reactive does not do this for Mutiny.StatelessSession (nor even for Uni<Mutiny.StatelessSession>) and this means that injection of Jakarta Data repositories is an almost impossible task for an unsophisticated user.

Yes, it's possible to make this work by writing your own @Producer method on a @RequestScoped bean, and also adding a custom @Interceptor to make sure everything gets cleaned up properly, but this was a task that took me more than an hour, not counting the time I spent fixing tangential issues I ran into along the way.

Implementation ideas

@FroMage already has some discussion of this in the context of Panache here: #46091, but this is actually more general and affects people who aren't using Panache.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions