Coder Social home page Coder Social logo

Comments (11)

quarkus-bot avatar quarkus-bot commented on June 28, 2024

/cc @DavideD (hibernate-reactive), @gavinking (hibernate-reactive), @gsmet (hibernate-orm), @mswatosh (db2), @yrodiere (hibernate-orm)

from quarkus.

DavideD avatar DavideD commented on June 28, 2024

I will give it a look

from quarkus.

DavideD avatar DavideD commented on June 28, 2024

I don't know why, but Hibernate ORM reads the wrong database version when picking the dialect.
@tmulle, as a workaround, you can set the following property in the application.properties:

quarkus.datasource.db-version=10.11

@yrodiere, any idea?

from quarkus.

tmulle avatar tmulle commented on June 28, 2024

@DavideD thanks that workaround does work. I will leave that in-place until an official fix is ready.

from quarkus.

yrodiere avatar yrodiere commented on June 28, 2024

I don't know why, but Hibernate ORM reads the wrong database version when picking the dialect.

What do you mean, "reads the wrong database version"? There is nothing to read, the dialect is picked offline, at build time.

Generally when db-version is not set, we pick Hibernate ORM's earliest supported version; in the case of MariaDB, it's 10.4, though for history reasons, Quarkus will default to 10.6 instead.

@tmulle, as a workaround, you can set the following property in the application.properties:

quarkus.datasource.db-version=10.11

This is not a workaround, this is the proper solution to this problem.

See https://quarkus.io/guides/hibernate-orm#hibernate-dialect-supported-databases:

By default, the dialect is configured to target the minimum supported version of the database.
In order for Hibernate ORM to generate more efficient SQL,
to avoid workarounds and to take advantage of more database features,
you can set the database version explicitly:

quarkus.datasource.db-kind = postgresql
quarkus.datasource.db-version = 14.0 
quarkus.datasource.username = hibernate
quarkus.datasource.password = hibernate
quarkus.datasource.jdbc.url = jdbc:postgresql://localhost:5432/hibernate_db

As a rule, the version set here should be as high as possible,
but must be lower than or equal to the version of any database your application will connect to.

Closing this issue, as this is not a bug: you really should configure your DB version if you expect features beyond what the oldest supported version of your database can offer.

from quarkus.

DavideD avatar DavideD commented on June 28, 2024

What do you mean, "reads the wrong database version"? There is nothing to read, the dialect is picked offline, at build time.

Ok, I get it and I didn't read the whole documentation, so I didn't know this was the expected behaviour.

But it's different than what happens with regular Hibernate ORM. So, unless somebody has read the documentation in detail, there's nothing that indicates that this is the correct behaviour. Not to mention that somebody might decide to switch database and not realizing that the new one is not supported.

It would be nice to have a message at start up containing the selected dialect with the version and a note that it's not supported so the default version will be used instead.

from quarkus.

DavideD avatar DavideD commented on June 28, 2024

It would be nice to have a message at start up containing the selected dialect with the version and a note that it's not supported so the default version will be used instead.

I guess I'm not the only one that thinks this is important info to have: #40922

from quarkus.

yrodiere avatar yrodiere commented on June 28, 2024

It would be nice to have a message at start up containing the selected dialect with the version and a note that it's not supported so the default version will be used instead.

The default version is used for supported dialects too.

from quarkus.

DavideD avatar DavideD commented on June 28, 2024

This is not what the documentation says, though:

For supported databases, the Hibernate ORM dialect does not need to be set explicitly: it is selected automatically based on the datasource.

from quarkus.

DavideD avatar DavideD commented on June 28, 2024

Ok... I guess the dialect is selected but the correct version isn't?

Am I the only one that thinks a bit more clarity would be nice?

from quarkus.

yrodiere avatar yrodiere commented on June 28, 2024

Ok... I guess the dialect is selected but the correct version isn't?

Yes.

Am I the only one that thinks a bit more clarity would be nice?

You're the first to report this particular problem, yes.

Feel free to send a PR if you have an idea how to improve the wording.

from quarkus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.