quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.57k stars 2.63k forks source link

How to implement dynamic table names using Reactive Hibernate? #25919

Open zuochangqin opened 2 years ago

zuochangqin commented 2 years ago

I have a requirement of using a different table name for each month, that is, adding a month after the name of the table. At the beginning, I used the customized implementation of physical-naming-strategy. Later, I found that I was still using the previous table in the cross-month period, but did not use the table of the new month.Could you please tell me how to solve this demand?

quarkus-bot[bot] commented 2 years ago

/cc @DavideD, @Sanne, @gavinking

DavideD commented 2 years ago

I think that happens because we create many SQL queries for each entity in advance. So once we have created them the first time, we don't need to recreate them anymore (unless one restarts the factory).

With Hibernate ORM one could use interceptors and rewrite the queries but I don't think we implement something similar in Reactive.

@gavinking Any idea?

Sanne commented 2 years ago

Let's make sure we migrate to ORM6 before improving such things. One reason being that Interceptor is different in 6, and among other changes it no longer offers the ability to customize the statements.

Secondarily: we should have ORM and HR both use the same approach for generating statements in advance, so that iff we re-introduce such a capability (TBD) they can invalidate/ignore the statements in the same approach.

zuochangqin commented 1 year ago

any changes?

DavideD commented 1 year ago

We haven't looked into this yet. We have just released Hibernate Reactive 2 CR1, and we are working on the last couple of things missing for the final.

If anybody wants to contribute and propose some solution, the SPI should be pretty stable now and it might be a good time.

pipinet commented 5 months ago

any updates?

DavideD commented 5 months ago

No, sorry. Nobody has been working into this.