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.haulmont.cuba.core.DataManagerTest.java

@Test
public void testTemporalType() throws Exception {
    Date nextYear = DateUtils.addYears(AppBeans.get(TimeSource.class).currentTimestamp(), 1);
    LoadContext<User> loadContext = LoadContext.create(User.class)
            .setQuery(LoadContext.createQuery("select u from sec$User u where u.createTs = :ts")
                    .setParameter("ts", nextYear, TemporalType.DATE));

    List<User> users = dataManager.loadList(loadContext);
    assertTrue(users.isEmpty());//from w ww . j  a  v a2 s  .c om
}

From source file:fr.amapj.service.services.saisiepermanence.PermanenceService.java

/**
 * /*from w  w w  .  j av  a  2  s. c om*/
 */
private List<PermanenceDTO> getDistributionsFutures(EntityManager em, Utilisateur user) {
    Date dateDebut = fr.amapj.common.DateUtils.firstMonday(new Date());

    Query q = em.createQuery("select distinct(du.datePermanence) from DatePermanenceUtilisateur du WHERE "
            + "du.datePermanence.datePermanence>=:deb and " + "du.utilisateur=:user "
            + "order by du.datePermanence.datePermanence");
    q.setParameter("deb", dateDebut, TemporalType.DATE);
    q.setParameter("user", user);

    List<DatePermanence> dds = q.getResultList();
    List<PermanenceDTO> res = new ArrayList<PermanenceDTO>();

    for (DatePermanence dd : dds) {
        PermanenceDTO dto = createDistributionDTO(em, dd);
        res.add(dto);
    }

    return res;
}

From source file:fr.amapj.service.services.meslivraisons.MesLivraisonsService.java

/**
 * /*from   w w  w  .  ja  va 2  s  .  c o  m*/
 */
private List<ContratCell> getAllQte(EntityManager em, Date dateDebut, Date dateFin, Utilisateur user) {
    Query q = em.createQuery("select c from ContratCell c WHERE " + "c.modeleContratDate.dateLiv>=:deb AND "
            + "c.modeleContratDate.dateLiv<=:fin and " + "c.contrat.utilisateur =:user "
            + "order by c.modeleContratDate.dateLiv, c.contrat.modeleContrat.producteur.id, c.contrat.modeleContrat.id , c.modeleContratProduit.indx");
    q.setParameter("deb", dateDebut, TemporalType.DATE);
    q.setParameter("fin", dateFin, TemporalType.DATE);
    q.setParameter("user", user);

    List<ContratCell> prods = q.getResultList();
    return prods;
}

From source file:fr.amapj.service.services.saisiepermanence.PermanenceService.java

/**
 * /*  w ww .  j ava 2 s . c o m*/
 */
public List<PermanenceDTO> getAllDistributions(EntityManager em, Date dateDebut, Date dateFin) {
    Query q = em.createQuery("select d from DatePermanence d WHERE " + "d.datePermanence>=:deb AND "
            + "d.datePermanence<=:fin " + "order by d.datePermanence, d.id");
    q.setParameter("deb", dateDebut, TemporalType.DATE);
    q.setParameter("fin", dateFin, TemporalType.DATE);

    List<DatePermanence> dds = q.getResultList();
    List<PermanenceDTO> res = new ArrayList<PermanenceDTO>();

    for (DatePermanence dd : dds) {
        PermanenceDTO dto = createDistributionDTO(em, dd);
        res.add(dto);
    }

    return res;
}

From source file:edu.northwestern.bioinformatics.studycalendar.domain.delta.Amendment.java

@Column(name = "amendment_date", nullable = false)
@Temporal(TemporalType.DATE)
public Date getDate() {
    return date;
}

From source file:com.softwarecorporativo.monitoriaifpe.servico.AtividadeService.java

@PermitAll
@Override//w  ww.j  a  v  a2 s .  c o m
public Atividade verificarExistencia(Atividade entidadeNegocio) {
    StringBuilder jpql = new StringBuilder();
    jpql.append("select a from ");
    jpql.append(getClasseEntidade().getSimpleName());
    jpql.append(" as a where a.monitoria = ?1 ");
    jpql.append(" and a.dataInicio = ?2 ");
    TypedQuery<Atividade> query = super.entityManager.createQuery(jpql.toString(), getClasseEntidade());
    query.setParameter(1, entidadeNegocio.getMonitoria());
    query.setParameter(2, entidadeNegocio.getDataInicio(), TemporalType.DATE);
    return query.getSingleResult();
}

From source file:gov.nih.nci.firebird.data.AbstractCredential.java

/**
 * @return effective date//from   w w  w .j  a v  a 2 s .  c  o m
 */
@Temporal(TemporalType.DATE)
@Column(name = "effective_date", nullable = true)
public Date getEffectiveDate() {
    return effectiveDate;
}

From source file:gov.nih.nci.firebird.data.SupplementalInvestigatorDataForm.java

/**
 * @return the phrpCertificationDate//from   www. j  a v  a 2 s. c  om
 */
@Column(name = "phrp_certification_date")
@Temporal(TemporalType.DATE)
public Date getPhrpCertificationDate() {
    return phrpCertificationDate;
}

From source file:gov.nih.nci.firebird.data.AbstractCredential.java

/**
 * @return the expiration date//from  ww  w  . j  a  v a2 s . c  o m
 */
@Temporal(TemporalType.DATE)
@Column(name = "expiration_date", nullable = true)
public Date getExpirationDate() {
    return expirationDate;
}

From source file:com.hive.enterprisemanage.entity.EEnterpriseinfo.java

@Temporal(TemporalType.DATE)
@Column(name = "DESTABLISHDATE", nullable = true, length = 7)
public Date getDestablishdate() {
    return this.destablishdate;
}