Skip to content

Commit 415406e

Browse files
committed
log the HR version
1 parent 80a9cfe commit 415406e

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/logging/impl/Log.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
public interface Log extends BasicLogger {
3333

3434
@LogMessage(level = INFO)
35-
@Message(id = 1, value = "Hibernate Reactive")
36-
void startHibernateReactive();
35+
@Message(id = 1, value = "Hibernate Reactive version %s")
36+
void startHibernateReactive(String version);
3737

3838
@LogMessage(level = INFO)
3939
@Message(id = 2, value = "Vert.x not detected, creating a new instance")
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* Hibernate, Relational Persistence for Idiomatic Java
2+
*
3+
* SPDX-License-Identifier: Apache-2.0
4+
* Copyright: Red Hat Inc. and Hibernate Authors
5+
*/
6+
package org.hibernate.reactive.logging.impl;
7+
8+
/**
9+
* Information about the version of Hibernate Reactive.
10+
*
11+
* @author Steve Ebersole
12+
*/
13+
public final class Version {
14+
15+
private static final String VERSION;
16+
static {
17+
final String version = Version.class.getPackage().getImplementationVersion();
18+
VERSION = version != null ? version : "[WORKING]";
19+
}
20+
21+
private Version() {
22+
}
23+
24+
/**
25+
* Access to the Hibernate Reactive version.
26+
*
27+
* @return The version
28+
*/
29+
public static String getVersionString() {
30+
return VERSION;
31+
}
32+
}

hibernate-reactive-core/src/main/java/org/hibernate/reactive/provider/impl/ReactiveIntegrator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.hibernate.reactive.event.impl.DefaultReactiveResolveNaturalIdEventListener;
2929
import org.hibernate.reactive.logging.impl.Log;
3030
import org.hibernate.reactive.logging.impl.LoggerFactory;
31+
import org.hibernate.reactive.logging.impl.Version;
3132
import org.hibernate.service.ServiceRegistry;
3233
import org.hibernate.service.spi.SessionFactoryServiceRegistry;
3334

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

5556
private void attachEventContextManagingListenersIfRequired(ServiceRegistry serviceRegistry) {
5657
if ( ReactiveModeCheck.isReactiveRegistry( serviceRegistry ) ) {
57-
LOG.startHibernateReactive();
58+
LOG.startHibernateReactive( Version.getVersionString() );
5859

5960
EventListenerRegistry eventListenerRegistry = serviceRegistry.getService( EventListenerRegistry.class );
6061
eventListenerRegistry.addDuplicationStrategy( ReplacementDuplicationStrategy.INSTANCE );

0 commit comments

Comments
 (0)