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.ElementType.METHOD; 017import static java.lang.annotation.RetentionPolicy.RUNTIME; 018 019/** 020 * Supports composite map keys that reference entities. 021 * <p> 022 * The <code>MapKeyJoinColumns</code> annotation groups <code>MapKeyJoinColumn</code> annotations. When the 023 * <code>MapKeyJoinColumns</code> annotation is used, both the <code>name</code> and the 024 * <code>referencedColumnName</code> elements must be specified in each of the grouped 025 * <code>MapKeyJoinColumn</code> annotations. 026 * 027 * @see MapKeyJoinColumn 028 * @since Java Persistence 2.0 029 */ 030@Target({METHOD, FIELD}) 031@Retention(RUNTIME) 032public @interface MapKeyJoinColumns { 033 /** 034 * (Required) The map key join columns that are used to map to the entity that is the map key. 035 * 036 * @return The join cols 037 */ 038 MapKeyJoinColumn[] value(); 039 040 /** 041 * (Optional) The foreign key constraint specification for the join columns. This is used only if table 042 * generation is in effect. Default is provider defined. 043 * 044 * @return The foreign key specification 045 */ 046 ForeignKey foreignKey() default @ForeignKey(); 047}