Skip to content

Migration Guide 1.3

Emmanuel Bernard edited this page Mar 9, 2020 · 19 revisions

Maven

You need to upgrade Maven to 3.6.2+ due to a bug in Maven resolver.

JUnit

You need JUnit 5.6+. It's included in our BOM but if you specify the version manually, you need to upgrade.

Class Loading

The class loading model for dev and test mode has changed, which should fix a number of issues around class loading that have been reported. Most applications should continue to work as normal with no changes required, however there are some changes that may effect testing. The most visible change is that @BeforeAll methods are now always run after Quarkus has started, so they can't be used to start resources Quarkus needs before boot. If you need to start resources before Quarkus has booted you can use the @QuarkusTestResource annotation to specify a QuarkusTestResourceLifecycleManager that can start and stop the resources.

Native images and GraalVM

19.3.1 and 20.0.0 are supported. Older versions are not.

Both JDK 8 and JDK 11 should work but keep in mind that GraalVM JDK 11 is a tech preview.

Hibernate ORM and Hibernate ORM with Panache

Bytecode-enhanced bi-directional association management is no longer activated. It was not comprehensive and we decided to embrace the principle of least surprise and disable it. Make sure to update both sides of your relationships explicitly in your code.

Some info about Bytecode-enhanced bi-directional association management

Hibernate Search + Elasticsearch (Preview)

Search DSL

A few methods in the Search DSL have been renamed:

  • searchSession.search(...).predicate(...) becomes searchSession.search(...).where(...).
  • searchSession.search(...).asProjection(...) becomes searchSession.search(...).select(...).
  • searchSession.search(...).asProjections(...) becomes searchSession.search(...).select(...).
  • searchSession.search(...).asEntity(...) becomes searchSession.search(...).selectEntity().
  • searchSession.search(...).asEntityReference(...) becomes searchSession.search(...).selectEntityReference().

The methods with the old name are still present, though deprecated. They will be removed before Hibernate Search 6.0.0.Final is released.

Index layout

Elasticsearch indexes are now accessed through aliases only. Hibernate Search relies on two aliases for each index: one for writes (<myindex>-write) and one for reads (<myindex>-read).

As a result, you will need to either create the two aliases, or drop your indexes and have Hibernate Search re-create empty indexes on startup: it will create the aliases.

See this section of the reference documentation for more information about index layout.

Configuration

The names of synchronization strategies for automatic indexing have changed:

  • queued => async.
  • committed (the default) => write-sync (still the default).
  • searchable (commonly used for tests) => sync (still recommended for tests only).

So if your configuration looked like this:

quarkus.hibernate-search.automatic_indexing.synchronization.strategy = queued

You should now have this:

quarkus.hibernate-search.automatic_indexing.synchronization.strategy = async

And if it looked like this:

quarkus.hibernate-search.automatic_indexing.synchronization.strategy = searchable

You should now have this:

quarkus.hibernate-search.automatic_indexing.synchronization.strategy = sync

See this section of the reference documentation for more information about synchronization strategies.

Reactive Messaging

The Emitter interface has slightly changed. First, the interface has moved to org.eclipse.microprofile.reactive.messaging.Emitter, as the interface is now part of the Reactive Messaging specification.

Also, sending Message has changed. The Emitter generic parameter is the payload type and cannot be the Message type:

// Before
@Inject @Channel("channel") Emitter<Message<String>> emitter;

// Now
@Inject @Channel("channel") Emitter<String> emitter;
emitter.send("foo");
emitter.send(Message.of("foo"));

Sending a payload returns a CompletionStage completed when the message is acknowledged.

Reactive Messaging Kafka Message -> Record

The KafkaMessage class has been renamed into KafkaRecord to be closer to the Kafka lingo.

Mutiny

In 1.3, a new reactive programming API has been introduced. This API named Mutiny (https://smallrye.io/smallrye-mutiny/) replaces the Axle and Reactive Streams Operators models (Reactive Streams and Completion Stage). The previous models are still functional, but deprecated and will be removed in the future. Refer to the various guide to show the differences and use the new API.

Current Version

Migration Guide 3.16

Next Version

Migration Guide 3.17

Clone this wiki locally