Example usage for org.hibernate Version getVersionString

List of usage examples for org.hibernate Version getVersionString

Introduction

In this page you can find the example usage for org.hibernate Version getVersionString.

Prototype

public static String getVersionString() 

Source Link

Document

Access to the Hibernate version.

Usage

From source file:com.actelion.research.spiritcore.services.dao.JPAUtil.java

License:Open Source License

/**
 *
 *///from   www .j  av  a  2s .c o m
private static void initialize() {
    LoggerFactory.getLogger(JPAUtil.class)
            .debug("JPA Factory Initialized. version: " + Version.getVersionString());

    assert factory == null;
    try {
        initFactory();
        getCurrentDateFromDatabase();
    } catch (RuntimeException ex) {
        throw ex;
    } catch (Throwable ex2) {
        LoggerFactory.getLogger(JPAUtil.class).error("Spirit: Initial EntityManagerFactory creation failed.",
                ex2);
        throw new RuntimeException(ex2);
    }
}

From source file:org.harms.hibernate5.example.Jpa21TestDao.java

License:Open Source License

public String getHibernateVersion() {
    return Version.getVersionString();
}

From source file:org.springframework.data.jpa.repository.cdi.EntityManagerFactoryProducer.java

License:Apache License

@Produces
@ApplicationScoped// www  .  java  2 s  .  c  o m
public EntityManagerFactory createEntityManagerFactory() {

    String hibernateVersion = Version.getVersionString();
    return Persistence.createEntityManagerFactory(hibernateVersion.startsWith("5.2") ? "cdi-52" : "cdi");
}

From source file:org.springframework.data.jpa.repository.query.PartTreeJpaQueryIntegrationTests.java

License:Apache License

private static boolean isHibernate43() {
    return Version.getVersionString().startsWith("4.3");
}

From source file:org.springframework.data.jpa.repository.query.PartTreeJpaQueryIntegrationTests.java

License:Apache License

private static boolean isHibernate5() {
    return Version.getVersionString().startsWith("5.");
}

From source file:org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformationIntegrationTests.java

License:Apache License

protected String getMetadadataPersitenceUnitName() {
    return Version.getVersionString().startsWith("5.2") ? "metadata-52" : "metadata";
}

From source file:org.tec.webapp.orm.service.impl.SystemSvcImpl.java

License:Apache License

/**
 * {@inheritDoc}/* ww w .j  av a2s . co m*/
 */
@Override()
public SerializableList<StatusBean> getStatus() {
    Connection conn = null;
    try {
        SerializableList<StatusBean> slist = new SerializableList<StatusBean>();

        // get java information
        slist.add(new StatusBean("java.version", System.getProperty("java.version")));

        //get Servlet information
        slist.add(new StatusBean("server.info", mServletContext.getServerInfo()));

        StringBuilder buff = new StringBuilder();

        buff.append(mServletContext.getMajorVersion());
        buff.append('.');
        buff.append(mServletContext.getMinorVersion());

        slist.add(new StatusBean("servlet.version", buff.toString()));

        // get database information
        conn = mDataSource.getConnection();
        DatabaseMetaData dmd = conn.getMetaData();
        slist.add(new StatusBean("database.server", dmd.getDatabaseProductName()));
        slist.add(new StatusBean("database.version", dmd.getDatabaseProductVersion()));
        slist.add(new StatusBean("jdbc.driver", dmd.getDriverName()));
        slist.add(new StatusBean("jdbc.driver.version", dmd.getDriverVersion()));

        // spring
        slist.add(new StatusBean("spring.version", SpringVersion.getVersion()));

        // hibernate
        slist.add(new StatusBean("hibernate.version", Version.getVersionString()));
        slist.add(new StatusBean("hibernate.session.factory", mSessionFactory.getClass().getName()));

        return slist;
    } catch (Throwable e) {
        throw new RuntimeException("failed to get system status", e);
    } finally {
        if (conn != null) {
            try {
                conn.close();
            } catch (Throwable e) {
                mLogger.error("failed to get system status", e);
            }
        }
    }
}