Skip to content

Support multiple persistence units for Hibernate Reactive #21110

@kazik666

Description

@kazik666

Describe the bug

In my test application.yaml I have configuration like below:

datasource:
  first:
    devservices:
      enabled: true
      image-name: mysql/mysql-server:8.0.21
    db-kind: mysql
  second:
    devservices:
      enabled: true
      image-name: mysql/mysql-server:8.0.21
    db-kind: mysql
hibernate-orm:
  first:
    datasource: first
    packages: com.db.model.first
    sql-load-script: import-first.sql
    database:
      generation: drop-and-create
  second:
    datasource: second
    packages: com.db.model.second
    sql-load-script: import-second.sql
    database:
      generation: drop-and-create

When I'am running tests I see warning message in console:
WARN: Skipping registration of ReactiveSessionFactoryProducer and ReactiveSessionProducer because exactly one persistence unit is required for their registration

And after that test failed with:
java.lang.NullPointerException: Cannot invoke "org.hibernate.reactive.mutiny.Mutiny$Session.createQuery(String)" because "em" is null

Expected behavior

Two persistent reactive units should be initialized properly.

Actual behavior

Non of reactive persistent units was initialized.

How to Reproduce?

No response

Output of uname -a or ver

Linux 5.13.0-20-generic #20-Ubuntu SMP Fri Oct 15 14:21:35 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

16.0.2

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.4.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.6.2

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions