forked from jakartaee/persistence
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new annotations for constructing named entity graphs
finally addresses issue jakartaee#118 Signed-off-by: Gavin King <[email protected]>
- Loading branch information
Showing
8 changed files
with
227 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
api/src/main/java/jakarta/persistence/NamedEntityGraphAttributeNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (c) 2011, 2023 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, | ||
* or the Eclipse Distribution License v. 1.0 which is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
*/ | ||
|
||
// Contributors: | ||
// Gavin King - 4.0 | ||
|
||
package jakarta.persistence; | ||
|
||
import java.lang.annotation.Repeatable; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.FIELD; | ||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
/** | ||
* Declares that the annotated attribute is an attribute node | ||
* in a {@linkplain NamedEntityGraph named entity graph}. The | ||
* {@link #graph} member must specify the name of the graph. | ||
* | ||
* @see EntityGraph#addAttributeNode | ||
* | ||
* @since 4.0 | ||
*/ | ||
@Repeatable(NamedEntityGraphAttributeNodes.class) | ||
@Target({FIELD, METHOD}) | ||
@Retention(RUNTIME) | ||
public @interface NamedEntityGraphAttributeNode { | ||
/** | ||
* The name of the containing entity graph, as specified by | ||
* {@link NamedEntityGraph#name}. If no name is explicitly | ||
* specified, the name defaults to the entity name of the | ||
* annotated root entity. | ||
*/ | ||
String graph() default ""; | ||
} | ||
|
36 changes: 36 additions & 0 deletions
36
api/src/main/java/jakarta/persistence/NamedEntityGraphAttributeNodes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (c) 2011, 2023 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, | ||
* or the Eclipse Distribution License v. 1.0 which is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
*/ | ||
|
||
// Contributors: | ||
// Gavin King - 4.0 | ||
|
||
|
||
package jakarta.persistence; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.FIELD; | ||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
/** | ||
* Used to group {@link NamedEntityGraphAttributeNode} annotations. | ||
* | ||
* @see NamedEntityGraphAttributeNode | ||
* @since 4.0 | ||
*/ | ||
@Target({FIELD, METHOD}) | ||
@Retention(RUNTIME) | ||
public @interface NamedEntityGraphAttributeNodes { | ||
NamedEntityGraphAttributeNode[] value(); | ||
} |
67 changes: 67 additions & 0 deletions
67
api/src/main/java/jakarta/persistence/NamedEntityGraphSubgraph.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright (c) 2011, 2023 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, | ||
* or the Eclipse Distribution License v. 1.0 which is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
*/ | ||
|
||
// Contributors: | ||
// Gavin King - 4.0 | ||
|
||
package jakarta.persistence; | ||
|
||
import java.lang.annotation.Repeatable; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.FIELD; | ||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
/** | ||
* Declares that the annotated association is the root of a | ||
* subgraph of a {@linkplain NamedEntityGraph named entity | ||
* graph}. | ||
* <ul> | ||
* <li>The {@link #graph} member must specify the name of | ||
* the containing graph. | ||
* <li>The {@link #subgraph} member specifies the name of | ||
* a named entity graph whose root is the associated | ||
* entity. | ||
* </ul> | ||
* | ||
* @see EntityGraph#addSubgraph | ||
* @see EntityGraph#addElementSubgraph | ||
* | ||
* @since 4.0 | ||
*/ | ||
@Repeatable(NamedEntityGraphSubgraphs.class) | ||
@Target({FIELD, METHOD}) | ||
@Retention(RUNTIME) | ||
public @interface NamedEntityGraphSubgraph { | ||
/** | ||
* The name of the containing entity graph, as specified by | ||
* {@link NamedEntityGraph#name}. If no name is explicitly | ||
* specified, the name defaults to the entity name of the | ||
* annotated root entity. | ||
*/ | ||
String graph() default ""; | ||
|
||
/** | ||
* The name of an entity graph whose root is the associated | ||
* entity, as specified by {@link NamedEntityGraph#name}. | ||
* If no subgraph name is explicitly specified, the subgraph | ||
* name defaults to the {@linkplain #graph name of the | ||
* containing graph}. | ||
* <p>The target subgraph must be explicitly declared via a | ||
* {@link NamedEntityGraph} annotation of the target entity | ||
* of the annotated association. | ||
*/ | ||
String subgraph() default ""; | ||
} | ||
|
36 changes: 36 additions & 0 deletions
36
api/src/main/java/jakarta/persistence/NamedEntityGraphSubgraphs.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (c) 2011, 2023 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, | ||
* or the Eclipse Distribution License v. 1.0 which is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
*/ | ||
|
||
// Contributors: | ||
// Gavin King - 4.0 | ||
|
||
|
||
package jakarta.persistence; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.FIELD; | ||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
/** | ||
* Used to group {@link NamedEntityGraphSubgraph} annotations. | ||
* | ||
* @see NamedEntityGraphSubgraph | ||
* @since 4.0 | ||
*/ | ||
@Target({FIELD, METHOD}) | ||
@Retention(RUNTIME) | ||
public @interface NamedEntityGraphSubgraphs { | ||
NamedEntityGraphSubgraph[] value(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters