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
202 additions
and
19 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 { | ||
/** | ||
* (Optional) The name of the 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(); | ||
} |
48 changes: 48 additions & 0 deletions
48
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,48 @@ | ||
/* | ||
* 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}. The {@link #graph} member must specify the name | ||
* of the graph. | ||
* | ||
* @see EntityGraph#addSubgraph | ||
* | ||
* @since 4.0 | ||
*/ | ||
@Repeatable(NamedEntityGraphSubgraphs.class) | ||
@Target({FIELD, METHOD}) | ||
@Retention(RUNTIME) | ||
public @interface NamedEntityGraphSubgraph { | ||
/** | ||
* (Optional) The name of the 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/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