Example usage for org.hibernate.cfg Environment jvmHasTimestampBug

List of usage examples for org.hibernate.cfg Environment jvmHasTimestampBug

Introduction

In this page you can find the example usage for org.hibernate.cfg Environment jvmHasTimestampBug.

Prototype

@Deprecated
public static boolean jvmHasTimestampBug() 

Source Link

Document

This will be removed soon; currently just returns false as no known JVM exibits this bug and is also able to run this version of Hibernate ORM.

Usage

From source file:org.osaf.cosmo.hibernate.CalendarType.java

License:Apache License

public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner)
        throws HibernateException, SQLException {

    TimeZone tz = (TimeZone) Hibernate.TIMEZONE.nullSafeGet(rs, names[1]);
    if (tz == null)
        tz = TimeZone.getDefault();
    Calendar cal = new GregorianCalendar(tz);

    Timestamp ts = rs.getTimestamp(names[0], cal);

    if (ts != null) {
        if (Environment.jvmHasTimestampBug()) {
            cal.setTime(new Date(ts.getTime() + ts.getNanos() / 1000000));
        } else {//from w  ww.  j  a v  a 2 s  .c  om
            cal.setTime(ts);
        }
        return cal;
    } else {
        return null;
    }
}