Example usage for javax.persistence TemporalType DATE

List of usage examples for javax.persistence TemporalType DATE

Introduction

In this page you can find the example usage for javax.persistence TemporalType DATE.

Prototype

TemporalType DATE

To view the source code for javax.persistence TemporalType DATE.

Click Source Link

Document

Map as java.sql.Date

Usage

From source file:com.encens.khipus.service.production.RawMaterialPayRollServiceBean.java

@Override
public void approvedSession(Calendar startDate, Calendar endDate, ProductiveZone productiveZone) {
    if (productiveZone != null) {
        getEntityManager().createQuery(/*  w ww.j  av a  2 s .c  om*/
                "update RawMaterialCollectionSession rawMaterialCollectionSession set rawMaterialCollectionSession.state = 'APPROVED'"
                        + " where rawMaterialCollectionSession.date between :startDate and :endDate "
                        + " and rawMaterialCollectionSession.productiveZone = :productiveZone")
                .setParameter("startDate", startDate, TemporalType.DATE)
                .setParameter("endDate", endDate, TemporalType.DATE)
                .setParameter("productiveZone", productiveZone).executeUpdate();
    } else {
        getEntityManager().createQuery(
                "update RawMaterialCollectionSession rawMaterialCollectionSession set rawMaterialCollectionSession.state = 'APPROVED'"
                        + " where rawMaterialCollectionSession.date between :startDate and :endDate ")
                .setParameter("startDate", startDate, TemporalType.DATE)
                .setParameter("endDate", endDate, TemporalType.DATE).executeUpdate();
    }
}