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.TYPE;
016import static java.lang.annotation.RetentionPolicy.RUNTIME;
017
018/**
019 * Specifies a composite primary key class that is mapped to
020 * multiple fields or properties of the entity.
021 * <p>
022 * <p> The names of the fields or properties in the primary key
023 * class and the primary key fields or properties of the entity
024 * must correspond and their types must be the same.
025 * <p>
026 * <pre>
027 *
028 *   Example:
029 *
030 *   &#064;IdClass(com.acme.EmployeePK.class)
031 *   &#064;Entity
032 *   public class Employee {
033 *      &#064;Id String empName;
034 *      &#064;Id Date birthDay;
035 *      ...
036 *   }
037 * </pre>
038 *
039 * @since Java Persistence 1.0
040 */
041@Target({TYPE})
042@Retention(RUNTIME)
043
044public @interface IdClass {
045
046  Class value();
047}