-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hibernate ORM and Hibernate Reactive cannot be used in the same application #13425
Comments
/cc @Sanne, @aguibert, @gavinking, @gsmet |
Using both Hibernate ORM and Hibernate Reactive in parallel is not supported at the moment. That's something we need to work on. |
Any work on this? |
This issue is blocking my workaround for #19302 |
Got bit trying to mix these too:
You can't use the hibernate reactive artifacts with panache-kotlin? |
I'm running into the same issue after trying to migrate to reactive dependencies. I do not know why this issue occurs. Not using Kotlin.
Would be really nice to have more telling error messages, especially when dependencies are clashing, like: "You cannot use dependency xyz when using reactive dependency x" |
I'd guess that quarkus-hibernate-envers is not reactive @mklueh. Have you tried removing it? |
@kenyee yes I did, nothing changed. |
you could try dumping dependencies... e.g. "./gradlew dependencies" to see what pulls in the non-reactive hibernate... |
@kenyee thanks, I'll try that. Does it have to be a non-reactive Hibernate dependency or could it also be something else? |
@mklueh mixing isn't allowed...so remove the thing that's pulling in the non-reactive version... |
@kenyee This is the only thing I've found
hibernate-orm is a transitive dependency of hibernate reactive |
sounds like you're ok then...can you post your full stack trace? |
I've excluded the validator dependency too test-wise, without any effect. This is the full stacktrace:
Edit: If it makes any difference, my project is a multi-module Gradle project. |
hmm...this still makes it look like you're mixing them: Can you look at the dependencies on all the other modules? Though running dependencies at the top should check all the others too 🤔 |
@kenyee I ran it on the application level, which includes all sub modules and I've searched through the whole dependency tree. The hibernate dependencies are included in the root build.gradle and not in the modules directly, so I don't have to change every build.gradle. Is there a chance to see the specific cause in the logs when changing the log level? |
If you could share a reproducer I'd like to have a look. To be clear, mixing is still not expected to work, but it looks like we should at very least improve the error messages or the diagnosticts to figure out what's happening in this case. |
It turned out I had removed the Hibernate dependencies, but kept the JDBC dependency
I was also running into this
as Quarkus seems to be still sensitive to the non-reactive properties and I had the db kind set I didn't know that the jdbc dependencies would also not be allowed together with Hibernate Reactive. Thanks for your help. |
@mklueh did you have to remove that property to fix that error? |
@kenyee yes, this helps, but also setting This means (pls correct me if I'm wrong), when you can't use JDBC together with reactive libraries, you cannot use the EntityManager, as it relies on JDBC. Meaning I have to migrate my EntityManager-based queries now to something else, that is provided by reactive libraries, ex.: I was thinking, that one could migrate gradually to reactive, and leave some endpoints non-reactive Edit: I fail to get According to the docs, I need the config property `` again https://quarkus.io/guides/reactive-sql-clients#configuring Then I'm getting the error again, and including the JDBC dependency leads to the first error again.
Edit: Got the pg-client now working EntityManager does not work without JDBC, but I'm okay with that. Gives:
pg-client works perfectly fine. What I did now:
|
I don't think you can do that w/o creating two microservices....the JDBC and reactive libraries seem to conflict. That means no EntityManager as well... |
@kenyee If I understand this right, I cannot use a hibernate reactive datasource and a non-reactive datasource in the same app right ? I just hit the wall for last two days trying to figure this out. I have got an app which uses hibernate orm reactive for postgresql. I got a requirement in the same app to pull some data from DB2. Started with db2-reactive and found there is an open issue with that (eclipse-vertx/vertx-sql-client#1131). So moved to plain non-reactive JDBC for DB2 but now hibernate ORM fails to pick the default datasource :(.
I guess I will have to write another service to handle this situation now. |
@yesvike yes...see 2nd comment above. For your case, that other bug is blocking your usage of db2-reactive so you'll need another service... |
@kenyee before I give up this just wanted to make sure that a hibernate orm reactive data source and plain jdbc data source (no hibernate orm also here) cannot exist together right. I just want to make sure that you did not think the second is non reactive hibernate orm. Second one actually plain jdbc. Thanks. |
@yesvike: What's interesting is if you dump hibernate-reactive's dependencies, it includes the plain JDBC one. |
I can't speak for Sanne, but as far as I'm concerned it's not so much "on the roadmap" as "something that we'd like to do at some point and that should be possible". Basically it'll happen when we have the time to work on it or if someone else contributes it. A contribution for a prerequisite of such a feature was started in #33790, but it seems stalled as the review comments haven't been addressed. Feel free to take over and send your own rebased and fixed version of that PR if you're interested :) |
Is this still an open issue in Quarkus 3? So an app cannot have a reactive and non-reactive datasource? quarkus.datasource.db-kind= mysql But when trying to use a orm panache repository I get the error: The documentation states that a datasource can be both reactive and non-reactive. |
Yes, as you can see.
An app cannot use both Hibernate ORM and Hibernate Reactive together at the moment. An app can have a reactive and a non-reactive datasource, provided you only use Hibernate ORM, or only Hibernate Reactive, or neither. And this limitation will stay until this issue gets fixed.
I'd need the full stacktrace to say for sure, but from what I can this exception is thrown by If you want to use Hibernate Reactive, replace your dependency to |
Any progress on this issue? |
|
Describe the bug
when i boot both hibernate-reactive and hibernate-orm in my own project it throw an IllegalStateException and Quarkus startup failure
My application.yaml:
I think it's probably because a private method checkIsReactive in PreconfiguredReactiveServiceRegistryBuilder.class .
This inspection is not supposed to be here.
It should be put in FastBootHibernateReactivePersistenceProvider.getEntityManagerFactoryBuilderOrNull where the RecordedState be created at.
This is more in keeping with the original purpose of the method getEntityManagerFactoryBuilderOrNull
The text was updated successfully, but these errors were encountered: