本文整理了Java中org.hibernate.Version.getVersionString()
方法的一些代码示例,展示了Version.getVersionString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.getVersionString()
方法的具体详情如下:
包路径:org.hibernate.Version
类名称:Version
方法名:getVersionString
[英]Access to the Hibernate version. IMPL NOTE : Real value is injected by the build.
[中]访问Hibernate版本。IMPL注:真正的价值是由构建注入的。
代码示例来源:origin: com.zaxxer/HikariCP
/**
* c-tor
*/
public HikariConnectionProvider()
{
this.hcfg = null;
this.hds = null;
if (Version.getVersionString().substring(0, 5).compareTo("4.3.6") >= 1) {
LOGGER.warn("com.zaxxer.hikari.hibernate.HikariConnectionProvider has been deprecated for versions of "
+ "Hibernate 4.3.6 and newer. Please switch to org.hibernate.hikaricp.internal.HikariCPConnectionProvider.");
}
}
代码示例来源:origin: hibernate/hibernate-orm
/**
* 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 Core {" + getVersionString() + "}" );
}
}
代码示例来源:origin: hibernate/hibernate-orm
/**
* Logs the Hibernate version (using {@link #getVersionString()}) to the logging system.
*/
public static void logVersion() {
Logger.getMessageLogger( CoreMessageLogger.class, Version.class.getName() ).version( getVersionString() );
}
代码示例来源:origin: HotswapProjects/HotswapAgent
/**
* Inits the plugin.
*
* @param original the original
*/
// call initializePlugin and setup version and EJB flag
private static void initPlugin(EntityManagerFactory original) {
ClassLoader appClassLoader = original.getClass().getClassLoader();
String version = Version.getVersionString();
PluginManagerInvoker.callInitializePlugin(Hibernate3JPAPlugin.class, appClassLoader);
PluginManagerInvoker.callPluginMethod(Hibernate3JPAPlugin.class, appClassLoader, "init", new Class[] { String.class, Boolean.class }, new Object[] { version, true });
}
}
代码示例来源:origin: HotswapProjects/HotswapAgent
private static void initPlugin(EntityManagerFactory original) {
ClassLoader appClassLoader = original.getClass().getClassLoader();
String version = Version.getVersionString();
PluginManagerInvoker.callInitializePlugin(HibernatePlugin.class, appClassLoader);
PluginManagerInvoker.callPluginMethod(HibernatePlugin.class, appClassLoader,
"init",
new Class[]{String.class, Boolean.class},
new Object[]{version, true});
}
}
代码示例来源:origin: HotswapProjects/HotswapAgent
/**
* Refresh all known wrapped factories.
*/
public static void refreshProxiedFactories() {
String[] version = Version.getVersionString().split("\\.");
boolean version43OrGreater = false;
try {
version43OrGreater = Integer.valueOf(version[0]) >= 4 && Integer.valueOf(version[1]) >= 3;
} catch (Exception e) {
LOGGER.warning("Unable to resolve hibernate version '{}'", Arrays.toString(version));
}
for (EntityManagerFactoryProxy wrapper : proxiedFactories.values())
try {
// lock proxy execution during reload
synchronized (wrapper.reloadLock) {
if (version43OrGreater) {
wrapper.refreshProxiedFactoryVersion43OrGreater();
} else {
wrapper.refreshProxiedFactory();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
代码示例来源:origin: HotswapProjects/HotswapAgent
/**
* Refresh all known wrapped factories.
*/
public static void refreshProxiedFactories() {
String[] version = Version.getVersionString().split("\\.");
boolean version43OrGreater = false;
try {
version43OrGreater = Integer.valueOf(version[0]) >= 5 || (Integer.valueOf(version[0]) == 4 && Integer.valueOf(version[1]) >= 3);
} catch (Exception e) {
LOGGER.warning("Unable to resolve hibernate version '{}'", version);
}
for (EntityManagerFactoryProxy wrapper : proxiedFactories.values()) {
String persistenceClassName = wrapper.properties == null ? null :
(String) wrapper.properties.get("PERSISTENCE_CLASS_NAME");
try {
// lock proxy execution during reload
synchronized (wrapper.reloadLock) {
if ("org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider".equals(persistenceClassName)) {
wrapper.refreshProxiedFactorySpring();
} else if (version43OrGreater) {
wrapper.refreshProxiedFactoryVersion43OrGreater();
} else {
wrapper.refreshProxiedFactory();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
代码示例来源:origin: spring-projects/spring-data-rest
public static boolean isHibernate5() {
return Version.getVersionString().startsWith("5");
}
}
代码示例来源:origin: spring-projects/spring-data-rest
public static boolean isHibernate4() {
return Version.getVersionString().startsWith("4");
}
代码示例来源:origin: liquibase/liquibase-hibernate
public String getDatabaseProductVersion() throws SQLException {
return Version.getVersionString();
}
代码示例来源:origin: org.springframework.data/spring-data-rest-webmvc
public static boolean isHibernate5() {
return Version.getVersionString().startsWith("5");
}
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
public static void main(String[] args) {
System.out.println( "Hibernate Core {" + getVersionString() + "}" );
}
}
代码示例来源:origin: Blazebit/blaze-persistence
private boolean isHibernate5() {
String version = org.hibernate.Version.getVersionString();
String[] versionParts = version.split("[\\.-]");
int major = Integer.parseInt(versionParts[0]);
return major >= 5;
}
代码示例来源:origin: Blazebit/blaze-persistence
protected boolean doesJpaMergeOfRecentlyPersistedEntityForceUpdate() {
// Not sure when exactly this got fixed, but 5.1 doesn't seem to have that problem
String version = org.hibernate.Version.getVersionString();
String[] versionParts = version.split("[\\.-]");
int major = Integer.parseInt(versionParts[0]);
int minor = Integer.parseInt(versionParts[1]);
int fix = Integer.parseInt(versionParts[2]);
return major < 5 || major == 5 && minor < 1 || major == 5 && minor == 1 && fix < 0;
}
代码示例来源:origin: com.zaxxer/HikariCP-java7
/**
* c-tor
*/
public HikariConnectionProvider()
{
this.hcfg = null;
this.hds = null;
if (Version.getVersionString().substring(0, 5).compareTo("4.3.6") >= 1) {
LOGGER.warn("com.zaxxer.hikari.hibernate.HikariConnectionProvider has been deprecated for versions of "
+ "Hibernate 4.3.6 and newer. Please switch to org.hibernate.hikaricp.internal.HikariCPConnectionProvider.");
}
}
代码示例来源:origin: Blazebit/blaze-persistence
@Override
protected boolean supportsMapKeyDeReference() {
// Only got introduced in 5.2.8
String version = org.hibernate.Version.getVersionString();
String[] versionParts = version.split("[\\.-]");
int major = Integer.parseInt(versionParts[0]);
int minor = Integer.parseInt(versionParts[1]);
int fix = Integer.parseInt(versionParts[2]);
return major > 5 || major == 5 && minor > 2 || major == 5 && minor == 2 && fix > 7;
}
代码示例来源:origin: Blazebit/blaze-persistence
private boolean isHibernate526OrOlder() {
String version = org.hibernate.Version.getVersionString();
String[] versionParts = version.split("[\\.-]");
int major = Integer.parseInt(versionParts[0]);
int minor = Integer.parseInt(versionParts[1]);
int fix = Integer.parseInt(versionParts[2]);
return major < 5 || major == 5 && minor < 2 || major == 5 && minor == 2 && fix < 7;
}
}
代码示例来源:origin: org.hibernate.orm/hibernate-core
/**
* 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 Core {" + getVersionString() + "}" );
}
}
代码示例来源:origin: org.hibernate.orm/hibernate-core
/**
* Logs the Hibernate version (using {@link #getVersionString()}) to the logging system.
*/
public static void logVersion() {
Logger.getMessageLogger( CoreMessageLogger.class, Version.class.getName() ).version( getVersionString() );
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
public static void logVersion() {
Logger.getMessageLogger( CoreMessageLogger.class, Version.class.getName() ).version( getVersionString() );
}
内容来源于网络,如有侵权,请联系作者删除!