org.hibernate.Version Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core Show documentation
Show all versions of hibernate-core Show documentation
Hibernate's core ORM functionality
The newest version!
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.build.AllowSysOut;
import org.jboss.logging.Logger;
import java.lang.invoke.MethodHandles;
/**
* Information about the version of Hibernate.
*
* @author Steve Ebersole
*/
public final class Version {
private static final String VERSION = initVersion();
private static String initVersion() {
final String version = Version.class.getPackage().getImplementationVersion();
return version != null ? version : "[WORKING]";
}
private Version() {
}
/**
* Access to the Hibernate ORM version.
*
* @return The Hibernate version
*/
public static String getVersionString() {
return VERSION;
}
/**
* Logs the Hibernate version (using {@link #getVersionString()}) to the logging system.
*/
public static void logVersion() {
Logger.getMessageLogger( MethodHandles.lookup(), CoreMessageLogger.class, Version.class.getName() ).version( getVersionString() );
}
/**
* Prints the Hibernate version (using {@link #getVersionString()}) to SYSOUT. Defined as the main-class in
* the hibernate-core jar
*
* @param args n/a
*/
@AllowSysOut
public static void main(String[] args) {
System.out.println( "Hibernate ORM core version " + getVersionString() );
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy