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.RetentionPolicy.RUNTIME; 016 017/** 018 * The NamedSubgraph annotation is used to further define an attribute node. It is referenced by its name from 019 * the subgraph or keySubgraph element of a NamedAttributeNode element. 020 * 021 * @since JPA 2.1 022 */ 023@Target({}) 024@Retention(RUNTIME) 025public @interface NamedSubgraph { 026 /** 027 * The name element is the name used to reference the subgraph from a NamedAttributeNode definition. In the case 028 * of entity inheritance, multiple subgraph elements have the same name. 029 * 030 * @return name 031 */ 032 String name(); 033 034 /** 035 * The type element must be specified when the subgraph corresponds to a subclass of the entity type corresponding 036 * to the referencing attribute node. 037 * 038 * @return type 039 */ 040 Class type() default void.class; 041 042 /** 043 * Lists attributes of the class that must be included. If the subgraph corresponds to a subclass of the class 044 * referenced by the corresponding attribute node, only subclass-specific attributes are listed. 045 * 046 * @return attribute nodes 047 */ 048 NamedAttributeNode[] attributeNodes(); 049}