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.lcw.one.common.persistence.DataEntity.java

@Temporal(TemporalType.DATE)
@Transient
public Date getUpdateDateEnd() {
    return DateUtils.getDateEnd(updateDateEnd);
}

From source file:uk.nhs.cfh.dsp.srth.demographics.person.impl.AbstractPerson.java

/**
 * Gets the dob.
 *
 * @return the dob
 */
@Temporal(javax.persistence.TemporalType.DATE)
public Calendar getDob() {
    return dob;
}

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

private List<DatePermanence> getAllDistributionsForUtilisateur(EntityManager em, Date dateDebut, Date dateFin,
        Utilisateur utilisateur) {// w ww . j  ava2s  .c  om
    Query q = em.createQuery("select distinct(du.datePermanence) from DatePermanenceUtilisateur du WHERE "
            + "du.datePermanence.datePermanence>=:deb and " + "du.datePermanence.datePermanence<=:fin and "
            + "du.utilisateur=:user " + "order by du.datePermanence.datePermanence");
    q.setParameter("deb", dateDebut, TemporalType.DATE);
    q.setParameter("fin", dateFin, TemporalType.DATE);
    q.setParameter("user", utilisateur);

    List<DatePermanence> dds = q.getResultList();

    return dds;
}

From source file:edu.ku.brc.specify.datamodel.Appraisal.java

/**
 * @return the appraisalDate/* www  .  j  av a2 s  .co  m*/
 */
@Temporal(TemporalType.DATE)
@Column(name = "AppraisalDate", unique = false, nullable = false, insertable = true, updatable = true)
public Calendar getAppraisalDate() {
    return appraisalDate;
}

From source file:com.haulmont.chile.jpa.loader.JPAAnnotationsLoader.java

@Override
protected Class getTypeOverride(AnnotatedElement element) {
    Temporal temporal = element.getAnnotation(Temporal.class);
    if (temporal != null && temporal.value().equals(TemporalType.DATE))
        return java.sql.Date.class;
    else if (temporal != null && temporal.value().equals(TemporalType.TIME))
        return java.sql.Time.class;
    else//from w w  w . j a  v  a  2  s  . c  o  m
        return null;
}

From source file:com.testing26thjuly_.db123testing.V1.java

@Id
@Temporal(TemporalType.DATE)
@Column(name = "`Date Col`", nullable = true)
public Date getDateCol() {
    return this.dateCol;
}

From source file:gov.nih.nci.protexpress.domain.experiment.Experiment.java

/**
 * Gets the datePerformed.//from  w w w . ja  v a  2  s .c  om
 *
 * @return the datePerformed.
 */
@Column(name = "date_performed")
@NotNull
@Temporal(TemporalType.DATE)
public Date getDatePerformed() {
    return datePerformed;
}

From source file:com.haulmont.cuba.gui.components.data.DataAwareComponentsTools.java

public void setupDateFormat(DateField component, EntityValueSource valueSource) {
    MetaProperty metaProperty = valueSource.getMetaPropertyPath().getMetaProperty();

    TemporalType tt = null;//from  w w w.  j  a v  a  2  s .c  om
    if (metaProperty.getRange().asDatatype().getJavaClass().equals(java.sql.Date.class)) {
        tt = TemporalType.DATE;
    } else if (metaProperty.getAnnotations() != null) {
        tt = (TemporalType) metaProperty.getAnnotations().get(MetadataTools.TEMPORAL_ANN_NAME);
    }

    component.setResolution(tt == TemporalType.DATE ? DateField.Resolution.DAY : DateField.Resolution.MIN);

    String formatStr = messageTools.getDefaultDateFormat(tt);
    component.setDateFormat(formatStr);
}

From source file:com.benfante.minimark.po.AssessmentTemplate.java

@Temporal(TemporalType.DATE)
public Date getAssessmentDate() {
    return assessmentDate;
}

From source file:com.sun.socialsite.userapi.UserManagerImpl.java

public List<User> getUsers(Boolean enabled, Date startDate, Date endDate, int offset, int length)
        throws UserManagementException {
    if (endDate == null) {
        endDate = new Date();
    }/* www. ja va 2 s  .c  om*/

    List<User> users = new ArrayList<User>();
    Query query = null;
    if (enabled != null) {
        if (startDate != null) {
            query = getNamedQuery("User.findByEnabled&StartDate&EndDateOrderByCreationDateDESC");
            query.setParameter("enabled", enabled);
            query.setParameter("startDate", startDate, TemporalType.DATE);
            query.setParameter("endDate", endDate, TemporalType.DATE);
        } else {
            query = getNamedQuery("User.findByEnabled&EndDateOrderByCreationDateDESC");
            query.setParameter("enabled", enabled);
            query.setParameter("endDate", endDate, TemporalType.DATE);
        }
    } else {
        if (startDate != null) {
            query = getNamedQuery("User.findByStartDate&EndDateOrderByCreationDateDESC");
            query.setParameter("startDate", startDate, TemporalType.DATE);
            query.setParameter("endDate", endDate, TemporalType.DATE);
        } else {
            query = getNamedQuery("User.findByEndDateOrderByCreationDateDESC");
            query.setParameter("endDate", endDate, TemporalType.DATE);
        }
    }
    if (offset != 0) {
        query.setFirstResult(offset);
    }
    if (length != -1) {
        query.setMaxResults(length);
    }
    List results = query.getResultList();
    if (results != null) {
        for (Object obj : results) {
            users.add((User) obj);
        }
    }
    return users;
}