001/* 002 * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. 003 * 004 * This program and the accompanying materials are made available under the 005 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 006 * which accompanies this distribution. The Eclipse Public License is available 007 * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License 008 * is available at http://www.eclipse.org/org/documents/edl-v10.php. 009 */ 010package javax.persistence; 011 012import java.lang.annotation.Retention; 013import java.lang.annotation.Target; 014 015import static java.lang.annotation.ElementType.FIELD; 016import static java.lang.annotation.RetentionPolicy.RUNTIME; 017 018/** 019 * This annotation must be specified for persistent fields or properties of type <code>java.util.Date</code> 020 * and <code>java.util.Calendar</code>. It may only be specified for fields or properties of these types. 021 * <p> 022 * The <code>Temporal</code> annotation may be used in conjunction with the {@link Basic} annotation, the 023 * {@link Id} annotation, or the {@link ElementCollection} annotation (when the element collection value is of 024 * such a temporal type. 025 * <p> 026 * <pre> 027 * Example: 028 * 029 * @Temporal(DATE) 030 * protected java.util.Date endDate; 031 * </pre> 032 * 033 * @since Java Persistence 1.0 034 */ 035@Target({FIELD}) 036@Retention(RUNTIME) 037public @interface Temporal { 038 /** 039 * The type used in mapping <code>java.util.Date</code> or <code>java.util.Calendar</code>. 040 * 041 * @return type 042 */ 043 TemporalType value(); 044}