Example usage for org.hibernate.type DbTimestampType DbTimestampType

List of usage examples for org.hibernate.type DbTimestampType DbTimestampType

Introduction

In this page you can find the example usage for org.hibernate.type DbTimestampType DbTimestampType.

Prototype

DbTimestampType

Source Link

Usage

From source file:com.joe.utilities.core.hibernate.repository.impl.ApplicationConfigurationRepositoryImpl.java

License:Open Source License

public Long retrieveDBTimeOffsetInMilliseconds() {
    DbTimestampType type = new DbTimestampType();
    Timestamp ts = (Timestamp) type.seed((SessionImplementor) getSession());
    Calendar cal = Calendar.getInstance();

    long actualTimeDiff = cal.getTimeInMillis() - ts.getTime();

    //System.out.println("Actual Time Diff in ms(AS - DB)="+actualTimeDiff);
    return new Long(actualTimeDiff);
}

From source file:com.joe.utilities.core.hibernate.repository.impl.ApplicationConfigurationRepositoryImpl.java

License:Open Source License

public Long retrieveDBTimeInMilliseconds() {
    DbTimestampType type = new DbTimestampType();
    Timestamp ts = (Timestamp) type.seed((SessionImplementor) getSession());
    return ts.getTime();
}