Example usage for javax.persistence.criteria CriteriaBuilder currentTimestamp

List of usage examples for javax.persistence.criteria CriteriaBuilder currentTimestamp

Introduction

In this page you can find the example usage for javax.persistence.criteria CriteriaBuilder currentTimestamp.

Prototype

Expression<java.sql.Timestamp> currentTimestamp();

Source Link

Document

Create expression to return current timestamp.

Usage

From source file:org.finra.dm.dao.impl.DmDaoImpl.java

private Timestamp getCurrentTimestamp() {
    // Create the criteria builder and the criteria.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<Timestamp> criteria = builder.createQuery(Timestamp.class);

    // Add the clauses for the query.
    criteria.select(builder.currentTimestamp()).from(ConfigurationEntity.class);

    return entityManager.createQuery(criteria).getSingleResult();
}

From source file:org.finra.herd.dao.impl.BaseJpaDaoImpl.java

@Override
public Timestamp getCurrentTimestamp() {
    // Create the criteria builder and the criteria.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<Timestamp> criteria = builder.createQuery(Timestamp.class);

    // Add the clauses for the query.
    criteria.select(builder.currentTimestamp()).from(ConfigurationEntity.class);

    return entityManager.createQuery(criteria).setMaxResults(1).getSingleResult();
}

From source file:org.finra.herd.dao.impl.HerdDaoImpl.java

/**
 * {@inheritDoc}//www  .j a  v  a 2  s  .  c o m
 */
@Override
public Timestamp getCurrentTimestamp() {
    // Create the criteria builder and the criteria.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<Timestamp> criteria = builder.createQuery(Timestamp.class);

    // Add the clauses for the query.
    criteria.select(builder.currentTimestamp()).from(ConfigurationEntity.class);

    return entityManager.createQuery(criteria).getSingleResult();
}