GERONIMO-6572 add JPA-2.2 enhancements
* some repeatable annotations
* Query and TypedQuery #getResultStream
git-svn-id: https://svn.apache.org/repos/asf/geronimo/specs/trunk@1854420 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/AssociationOverride.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/AssociationOverride.java
index 950908a..9194e02 100644
--- a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/AssociationOverride.java
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/AssociationOverride.java
@@ -24,6 +24,7 @@
//
package javax.persistence;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
@@ -34,7 +35,7 @@
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
-
+@Repeatable(AssociationOverrides.class)
public @interface AssociationOverride {
String name();
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/AttributeOverride.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/AttributeOverride.java
index 1dd84d5..4103dd8 100644
--- a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/AttributeOverride.java
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/AttributeOverride.java
@@ -24,6 +24,7 @@
//
package javax.persistence;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
@@ -34,7 +35,7 @@
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
-
+@Repeatable(AttributeOverrides.class)
public @interface AttributeOverride {
String name();
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/Convert.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/Convert.java
index 3d2776d..6c3274e 100644
--- a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/Convert.java
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/Convert.java
@@ -24,6 +24,7 @@
//
package javax.persistence;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
@@ -31,7 +32,9 @@
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
-@Target({METHOD, FIELD, TYPE}) @Retention(RUNTIME)
+@Target({METHOD, FIELD, TYPE})
+@Retention(RUNTIME)
+@Repeatable(Converts.class)
public @interface Convert {
Class converter() default void.class;
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/JoinColumn.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/JoinColumn.java
index f0c14da..1d23ee3 100644
--- a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/JoinColumn.java
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/JoinColumn.java
@@ -24,6 +24,7 @@
//
package javax.persistence;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.FIELD;
@@ -33,6 +34,7 @@
@Target({METHOD, FIELD})
@Retention(RUNTIME)
+@Repeatable(JoinColumns.class)
public @interface JoinColumn {
String name() default "";
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/MapKeyJoinColumn.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/MapKeyJoinColumn.java
index 4317567..240144a 100644
--- a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/MapKeyJoinColumn.java
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/MapKeyJoinColumn.java
@@ -24,6 +24,7 @@
//
package javax.persistence;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.FIELD;
@@ -33,6 +34,7 @@
@Target( { METHOD, FIELD })
@Retention(RUNTIME)
+@Repeatable(MapKeyJoinColumns.class)
public @interface MapKeyJoinColumn {
String name() default "";
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/NamedEntityGraph.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/NamedEntityGraph.java
index ff789da..cd99f17 100644
--- a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/NamedEntityGraph.java
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/NamedEntityGraph.java
@@ -25,6 +25,7 @@
package javax.persistence;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
@@ -32,6 +33,7 @@
@Target({TYPE})
@Retention(RUNTIME)
+@Repeatable(NamedEntityGraphs.class)
public @interface NamedEntityGraph {
String name() default "";
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/NamedNativeQuery.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/NamedNativeQuery.java
index b7cd3b2..d1e9c26 100644
--- a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/NamedNativeQuery.java
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/NamedNativeQuery.java
@@ -24,6 +24,7 @@
//
package javax.persistence;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
@@ -32,6 +33,7 @@
@Target({TYPE})
@Retention(RUNTIME)
+@Repeatable(NamedNativeQueries.class)
public @interface NamedNativeQuery {
String name();
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/NamedQuery.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/NamedQuery.java
index cf1c3fa..bdb24fc 100644
--- a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/NamedQuery.java
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/NamedQuery.java
@@ -24,6 +24,7 @@
//
package javax.persistence;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static javax.persistence.LockModeType.NONE;
@@ -33,6 +34,7 @@
@Target({TYPE})
@Retention(RUNTIME)
+@Repeatable(NamedQueries.class)
public @interface NamedQuery {
String name();
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/NamedStoredProcedureQuery.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/NamedStoredProcedureQuery.java
index af0a5fc..eab9bd8 100644
--- a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/NamedStoredProcedureQuery.java
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/NamedStoredProcedureQuery.java
@@ -24,6 +24,7 @@
//
package javax.persistence;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
@@ -31,6 +32,7 @@
@Target({TYPE})
@Retention(RUNTIME)
+@Repeatable(NamedStoredProcedureQueries.class)
public @interface NamedStoredProcedureQuery {
String name();
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/PersistenceContext.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/PersistenceContext.java
index 35bd5bf..cce8744 100644
--- a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/PersistenceContext.java
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/PersistenceContext.java
@@ -24,6 +24,7 @@
//
package javax.persistence;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.*;
import java.lang.annotation.Retention;
@@ -32,6 +33,7 @@
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
+@Repeatable(PersistenceContexts.class)
public @interface PersistenceContext {
String name() default "";
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/PersistenceUnit.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/PersistenceUnit.java
index eacfbe4..38fb6b3 100644
--- a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/PersistenceUnit.java
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/PersistenceUnit.java
@@ -24,6 +24,7 @@
//
package javax.persistence;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.*;
import java.lang.annotation.Retention;
@@ -33,6 +34,7 @@
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
+@Repeatable(PersistenceUnits.class)
public @interface PersistenceUnit {
String name() default "";
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/PrimaryKeyJoinColumn.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/PrimaryKeyJoinColumn.java
index ef5910a..f27b90c 100644
--- a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/PrimaryKeyJoinColumn.java
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/PrimaryKeyJoinColumn.java
@@ -24,6 +24,7 @@
//
package javax.persistence;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.METHOD;
@@ -34,7 +35,7 @@
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
-
+@Repeatable(PrimaryKeyJoinColumns.class)
public @interface PrimaryKeyJoinColumn {
String name() default "";
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/Query.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/Query.java
index 811eaff..c05fd90 100644
--- a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/Query.java
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/Query.java
@@ -31,6 +31,7 @@
import java.util.List;
import java.util.Set;
import java.util.Map;
+import java.util.stream.Stream;
public interface Query {
@@ -104,4 +105,8 @@
LockModeType getLockMode();
<T> T unwrap(Class<T> cls);
+
+ default Stream getResultStream() {
+ return getResultList().stream();
+ }
}
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/SecondaryTable.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/SecondaryTable.java
index b625144..7aac497 100644
--- a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/SecondaryTable.java
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/SecondaryTable.java
@@ -24,6 +24,7 @@
//
package javax.persistence;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
@@ -32,7 +33,7 @@
@Target(TYPE)
@Retention(RUNTIME)
-
+@Repeatable(SecondaryTables.class)
public @interface SecondaryTable {
String name();
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/SequenceGenerator.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/SequenceGenerator.java
index 1113733..e1305da 100644
--- a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/SequenceGenerator.java
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/SequenceGenerator.java
@@ -24,6 +24,7 @@
//
package javax.persistence;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.METHOD;
@@ -34,6 +35,7 @@
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
+@Repeatable(SequenceGenerators.class)
public @interface SequenceGenerator {
String name();
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/SequenceGenerators.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/SequenceGenerators.java
new file mode 100644
index 0000000..e4c8840
--- /dev/null
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/SequenceGenerators.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+//
+// This source code implements specifications defined by the Java
+// Community Process. In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Target({TYPE, METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface SequenceGenerators {
+ SequenceGenerator[] value();
+}
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/SqlResultSetMapping.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/SqlResultSetMapping.java
index 5d90c8a..500a094 100644
--- a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/SqlResultSetMapping.java
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/SqlResultSetMapping.java
@@ -24,6 +24,7 @@
//
package javax.persistence;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
@@ -31,6 +32,7 @@
@Target({TYPE})
@Retention(RUNTIME)
+@Repeatable(SqlResultSetMappings.class)
public @interface SqlResultSetMapping {
String name();
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/TableGenerator.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/TableGenerator.java
index ceebd55..26739b7 100644
--- a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/TableGenerator.java
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/TableGenerator.java
@@ -24,6 +24,7 @@
//
package javax.persistence;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.FIELD;
@@ -33,6 +34,7 @@
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
+@Repeatable(TableGenerators.class)
public @interface TableGenerator {
String name();
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/TableGenerators.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/TableGenerators.java
new file mode 100644
index 0000000..f33be9b
--- /dev/null
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/TableGenerators.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+//
+// This source code implements specifications defined by the Java
+// Community Process. In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Target({TYPE, METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface TableGenerators {
+ TableGenerator[] value();
+}
diff --git a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/TypedQuery.java b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/TypedQuery.java
index 1001bac..c58c0fd 100644
--- a/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/TypedQuery.java
+++ b/geronimo-jpa_2.2_spec/src/main/java/javax/persistence/TypedQuery.java
@@ -28,6 +28,7 @@
import java.util.List;
import java.util.Date;
import java.util.Calendar;
+import java.util.stream.Stream;
public interface TypedQuery<X> extends Query {
@@ -70,4 +71,7 @@
TypedQuery<X> setLockMode(LockModeType lockMode);
+ default Stream<X> getResultStream() {
+ return getResultList().stream();
+ }
}