Skip to content

log the HR version #2226

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

Merged
merged 1 commit into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
public interface Log extends BasicLogger {

@LogMessage(level = INFO)
@Message(id = 1, value = "Hibernate Reactive")
void startHibernateReactive();
@Message(id = 1, value = "Hibernate Reactive version %s")
void startHibernateReactive(String version);

@LogMessage(level = INFO)
@Message(id = 2, value = "Vert.x not detected, creating a new instance")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* Hibernate, Relational Persistence for Idiomatic Java
*
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.reactive.logging.impl;

/**
* Information about the version of Hibernate Reactive.
*
* @author Steve Ebersole
*/
public final class Version {

private static final String VERSION;
static {
final String version = Version.class.getPackage().getImplementationVersion();
VERSION = version != null ? version : "[WORKING]";
}

private Version() {
}

/**
* Access to the Hibernate Reactive version.
*
* @return The version
*/
public static String getVersionString() {
return VERSION;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.hibernate.reactive.event.impl.DefaultReactiveResolveNaturalIdEventListener;
import org.hibernate.reactive.logging.impl.Log;
import org.hibernate.reactive.logging.impl.LoggerFactory;
import org.hibernate.reactive.logging.impl.Version;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.spi.SessionFactoryServiceRegistry;

Expand All @@ -54,7 +55,7 @@ public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactor

private void attachEventContextManagingListenersIfRequired(ServiceRegistry serviceRegistry) {
if ( ReactiveModeCheck.isReactiveRegistry( serviceRegistry ) ) {
LOG.startHibernateReactive();
LOG.startHibernateReactive( Version.getVersionString() );

EventListenerRegistry eventListenerRegistry = serviceRegistry.getService( EventListenerRegistry.class );
eventListenerRegistry.addDuplicationStrategy( ReplacementDuplicationStrategy.INSTANCE );
Expand Down
Loading