Skip to content
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

Upgrade to Hibernate ORM 6.6 / Search 7.2 / Reactive 2.4 #41359

Merged
merged 8 commits into from
Aug 10, 2024

Conversation

yrodiere
Copy link
Member

@yrodiere yrodiere commented Jun 21, 2024

Work in progress; we need releases of ORM, Search and Reactive before we can merge this. => Done

Here's what we will need to add to the migration guide:

== JPA / Hibernate ORM

=== Upgrade to Hibernate ORM 6.6

The Quarkus extensions for Hibernate ORM was upgraded to Hibernate ORM 6.6.

Hibernate ORM 6.6 is largely backwards-compatible with Hibernate ORM 6.5,
but a few checks have been tightened, so applications with incorrect configuration, mapping, or queries
may now throw exceptions where they used to experience only warnings and malfunctions. In particular:

* https://docs.jboss.org/hibernate/orm/6.6/migration-guide/migration-guide.html#merge-versioned-entity-when-row-is-deleted[Merging detects invalid creation attempts]:
passing to `merge` an entity with a `@GeneratedValue` identifier or a `@Version` property set to a non-null value
will now fail, whereas it used to (incorrectly) create the entity in database.
* https://docs.jboss.org/hibernate/orm/6.6/migration-guide/migration-guide.html#explicit-validation-of-annotated-class-types[Applying both `@MappedSuperclass` and `@Embeddable` on the same type is not longer allowed].

Some features are also now enabled by default to avoid unexpected -- and arguably error-prone -- behavior:

* https://docs.jboss.org/hibernate/orm/6.6/migration-guide/migration-guide.html#discriminator-based-embeddable-inheritance[Embeddables with `@Embeddable` annotated subtypes will now use discriminator-based inheritance by default].

Finally, behavior was altered in some cases to comply with the JPA specification:

* https://docs.jboss.org/hibernate/orm/6.6/migration-guide/migration-guide.html#criteria-jakartapersistencecriteriaexpressionasclass[`jakarta.persistence.criteria.Expression#as(Class)` is now an unchecked cast]: use `org.hibernate.query.criteria.JpaExpression#cast(Class)` to perform a checked cast.

See the https://docs.jboss.org/hibernate/orm/6.6/migration-guide/migration-guide.html[Hibernate ORM 6.6 migration guide] for more details.

@quarkus-bot quarkus-bot bot added area/dependencies Pull requests that update a dependency file area/hibernate-orm Hibernate ORM area/hibernate-reactive Hibernate Reactive area/persistence OBSOLETE, DO NOT USE labels Jun 21, 2024
@quarkus-bot
Copy link

quarkus-bot bot commented Jun 21, 2024

/cc @gsmet (hibernate-orm)

@quarkus-bot
Copy link

quarkus-bot bot commented Jun 21, 2024

Thanks for your pull request!

The title of your pull request does not follow our editorial rules. Could you have a look?

  • title should preferably start with an uppercase character (if it makes sense!)

This message is automatically generated by a bot.

Copy link

github-actions bot commented Jun 28, 2024

🎊 PR Preview c24efa8 has been successfully built and deployed to https://quarkus-pr-main-41359-preview.surge.sh/version/main/guides/

  • Images of blog posts older than 3 months are not available.
  • Newsletters older than 3 months are not available.

@quarkus-bot

This comment has been minimized.

yrodiere and others added 8 commits August 9, 2024 15:01
It no longer has a purpose:

1. We removed the type caching in a previous commit, because it wasn't
   used anymore: ORM hasn't needed access to generator types at runtime
   for a while now.
2. StandardIdentifierGeneratorFactory has a constructor parameter to
   disable reliance on CDI, so we don't need to rewrite that code.
3. StandardIdentifierGeneratorFactory is registering custom generators
   itself, so we don't need to make `register` public to register them
   externally.
Since the database is not available during static init,
the connection provider is just a stub that will fail on connection retrieval.

This doesn't change anything functionally, but is a safer setup that will
avoid problems such as the one we have with logging of DB info:
https://hibernate.zulipchat.com/#narrow/stream/132094-hibernate-orm-dev/topic/HHH-18224.20Log.20DB.20info
@gsmet
Copy link
Member

gsmet commented Aug 9, 2024

I rebased, updated to the Final versions and force pushed.

@marko-bekhta
Copy link
Contributor

thanks! 🎉

@gsmet gsmet changed the title [WIP] Upgrade to Hibernate ORM 6.6 / Search 7.2 / Reactive 2.4 Upgrade to Hibernate ORM 6.6 / Search 7.2 / Reactive 2.4 Aug 9, 2024
@gsmet
Copy link
Member

gsmet commented Aug 9, 2024

I added the content written by Yoann to the migration guide.

@quarkus-bot
Copy link

quarkus-bot bot commented Aug 9, 2024

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 09706de.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.

@gsmet gsmet merged commit b6ef7f6 into quarkusio:main Aug 10, 2024
52 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.14 - main milestone Aug 10, 2024
@yrodiere yrodiere deleted the orm6.6 branch October 3, 2024 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment