JPA_SPEC-115: Adding repeating annotations support for Sequence/Table Generators
Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
diff --git a/src/javax/persistence/SequenceGenerator.java b/src/javax/persistence/SequenceGenerator.java
index 8a0440b..edb8f85 100644
--- a/src/javax/persistence/SequenceGenerator.java
+++ b/src/javax/persistence/SequenceGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
+ * Copyright (c) 2008 - 2017 Oracle Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
@@ -9,6 +9,7 @@
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
+ * Lukas Jungmann - Java Persistence 2.2
* Linda DeMichiel - Java Persistence 2.1
* Linda DeMichiel - Java Persistence 2.0
*
@@ -22,6 +23,8 @@
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Repeatable;
+
/**
* Defines a primary key generator that may be referenced by name when
* a generator element is specified for the {@link GeneratedValue}
@@ -38,6 +41,7 @@
*
* @since Java Persistence 1.0
*/
+@Repeatable(SequenceGenerators.class)
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
public @interface SequenceGenerator {
diff --git a/src/javax/persistence/SequenceGenerators.java b/src/javax/persistence/SequenceGenerators.java
new file mode 100644
index 0000000..9991e05
--- /dev/null
+++ b/src/javax/persistence/SequenceGenerators.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Oracle Corporation. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Lukas Jungmann - Java Persistence 2.2
+ *
+ ******************************************************************************/
+package javax.persistence;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Used to group <code>SequenceGenerator</code> annotations.
+ *
+ * @see SequenceGenerator
+ * @since Java Persistence 2.2
+ */
+@Target({TYPE, METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface SequenceGenerators {
+
+ SequenceGenerator[] value();
+}
diff --git a/src/javax/persistence/TableGenerator.java b/src/javax/persistence/TableGenerator.java
index 4c4a0a7..e87a932 100644
--- a/src/javax/persistence/TableGenerator.java
+++ b/src/javax/persistence/TableGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
+ * Copyright (c) 2008 - 2017 Oracle Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
@@ -9,6 +9,7 @@
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
+ * Lukas Jungmann - Java Persistence 2.2
* Linda DeMichiel - Java Persistence 2.1
* Linda DeMichiel - Java Persistence 2.0
*
@@ -22,6 +23,8 @@
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Repeatable;
+
/**
* Defines a primary key generator that may be
* referenced by name when a generator element is specified for
@@ -69,6 +72,7 @@
*
* @since Java Persistence 1.0
*/
+@Repeatable(TableGenerators.class)
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
public @interface TableGenerator {
diff --git a/src/javax/persistence/TableGenerators.java b/src/javax/persistence/TableGenerators.java
new file mode 100644
index 0000000..3c16791
--- /dev/null
+++ b/src/javax/persistence/TableGenerators.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Oracle Corporation. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Lukas Jungmann - Java Persistence 2.2
+ *
+ ******************************************************************************/
+package javax.persistence;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Used to group <code>TableGenerator</code> annotations.
+ *
+ * @see TableGenerator
+ * @since Java Persistence 2.2
+ */
+@Target({TYPE, METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface TableGenerators {
+
+ TableGenerator[] value();
+}