openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1756850 - in /openjpa/trunk: ./ openjpa-integration/tck/ openjpa-integration/validation/ openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/i...
Date Thu, 18 Aug 2016 20:47:20 GMT
Author: struberg
Date: Thu Aug 18 20:47:20 2016
New Revision: 1756850

URL: http://svn.apache.org/viewvc?rev=1756850&view=rev
Log:
OPENJPA-2592 OPENJPA-2654 merge JPA-2.1 work originally done by rmannibucau in the openjpa-jpa-2.1 branch

Thanks to Romain for all the hard work!

Added:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/StoredProcedureQuery.java
      - copied unchanged from r1683972, openjpa/branches/openjpa_jpa-2.1/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/StoredProcedureQuery.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/XROP.java
      - copied unchanged from r1683972, openjpa/branches/openjpa_jpa-2.1/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/XROP.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/StoredProcedure.java
      - copied unchanged from r1683972, openjpa/branches/openjpa_jpa-2.1/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/StoredProcedure.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryResultCallback.java
      - copied unchanged from r1683972, openjpa/branches/openjpa_jpa-2.1/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryResultCallback.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MultiQueryMetaData.java
      - copied unchanged from r1683972, openjpa/branches/openjpa_jpa-2.1/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MultiQueryMetaData.java
    openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/BatchedResultObjectProvider.java
      - copied unchanged from r1683972, openjpa/branches/openjpa_jpa-2.1/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/BatchedResultObjectProvider.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/procedure/
      - copied from r1683972, openjpa/branches/openjpa_jpa-2.1/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/procedure/
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/StoredProcedureQueryImpl.java
      - copied unchanged from r1683972, openjpa/branches/openjpa_jpa-2.1/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/StoredProcedureQueryImpl.java
Modified:
    openjpa/trunk/   (props changed)
    openjpa/trunk/openjpa-integration/tck/pom.xml
    openjpa/trunk/openjpa-integration/validation/pom.xml
    openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyProvider1.java
    openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyProvider2.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifier.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/QueryResultMapping.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java
    openjpa/trunk/openjpa-jest/pom.xml
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryLanguages.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
    openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/AnnotationPersistenceMappingParser.java
    openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/MappingTag.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/NonstandardMappingEntity.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/AbstractPersistenceTestCase.java
    openjpa/trunk/openjpa-persistence/pom.xml
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AbstractQuery.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MetaDataTag.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/StoreCacheImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaBuilderImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Joins.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/SubqueryImpl.java
    openjpa/trunk/openjpa-project/assembly.xml
    openjpa/trunk/openjpa-project/bin-assembly.xml
    openjpa/trunk/openjpa-slice/pom.xml
    openjpa/trunk/openjpa-tools/openjpa-fetch-statistics/pom.xml
    openjpa/trunk/openjpa-tools/openjpa-maven-plugin/pom.xml
    openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/pom.xml
    openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/dependingArtifact/pom.xml
    openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/enhanceIncludesExcludes/pom.xml
    openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/nonDefaultPersistenceXml/pom.xml
    openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/sqlActionDropSchema/pom.xml
    openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/testDependencies/pom.xml
    openjpa/trunk/pom.xml
    openjpa/trunk/scripts/mmg.bat

Propchange: openjpa/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 18 20:47:20 2016
@@ -4,3 +4,4 @@
 /openjpa/branches/2.2.1.x:1415367,1415413,1415425,1504719,1508186,1530347,1533222,1539193,1651808,1686910
 /openjpa/branches/2.2.x:1384400,1415459-1415460,1415469,1485013,1530364,1533223,1580898,1580939,1591681,1631786,1641906,1642555,1666312,1686911,1700884,1702143,1728038,1756046,1756538
 /openjpa/branches/2.3.x:1533462,1535560,1536912,1540277,1564121
+/openjpa/branches/openjpa_jpa-2.1:1683942,1683972

Modified: openjpa/trunk/openjpa-integration/tck/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-integration/tck/pom.xml?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-integration/tck/pom.xml (original)
+++ openjpa/trunk/openjpa-integration/tck/pom.xml Thu Aug 18 20:47:20 2016
@@ -459,7 +459,7 @@ databaseName=${db.name}
         <dependencies>
           <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-jpa_2.0_spec</artifactId>
+            <artifactId>geronimo-jpa_2.1_spec</artifactId>
             <scope>compile</scope>
           </dependency>
           <dependency>

Modified: openjpa/trunk/openjpa-integration/validation/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-integration/validation/pom.xml?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-integration/validation/pom.xml (original)
+++ openjpa/trunk/openjpa-integration/validation/pom.xml Thu Aug 18 20:47:20 2016
@@ -95,7 +95,7 @@
                     <version>4.0.2.GA</version>
                     <scope>test</scope>
                     <exclusions>
-                        <!-- force usage of the geronimo-jpa_2.0_spec -->
+                        <!-- force usage of the geronimo-jpa_2.1_spec -->
                         <exclusion>
                             <groupId>org.hibernate.java-persistence</groupId>
                             <artifactId>jpa-api</artifactId>

Modified: openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyProvider1.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyProvider1.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyProvider1.java (original)
+++ openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyProvider1.java Thu Aug 18 20:47:20 2016
@@ -32,6 +32,16 @@ public class DummyProvider1 implements P
         return null;
     }
 
+    @Override
+    public void generateSchema(PersistenceUnitInfo info, Map map) {
+        // no-op
+    }
+
+    @Override
+    public boolean generateSchema(String persistenceUnitName, Map map) {
+        return false;
+    }
+
     public EntityManagerFactory createEntityManagerFactory(String s, Map map) {
         return null;
     }

Modified: openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyProvider2.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyProvider2.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyProvider2.java (original)
+++ openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/persistence/provider/DummyProvider2.java Thu Aug 18 20:47:20 2016
@@ -32,6 +32,16 @@ public class DummyProvider2 implements P
         return null;
     }
 
+    @Override
+    public void generateSchema(PersistenceUnitInfo info, Map map) {
+        // no-op
+    }
+
+    @Override
+    public boolean generateSchema(String persistenceUnitName, Map map) {
+        return false;
+    }
+
     public EntityManagerFactory createEntityManagerFactory(String s, Map map) {
         return null;
     }

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifier.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifier.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifier.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifier.java Thu Aug 18 20:47:20 2016
@@ -46,6 +46,7 @@ public class DBIdentifier extends Identi
         INDEX,
         FOREIGN_KEY,
         CONSTANT,
+        PROCEDURE,
         NULL
     }
     
@@ -603,6 +604,10 @@ public class DBIdentifier extends Identi
         return newIdentifier(name,id, toUpper, delimit, false);
     }
 
+    public static DBIdentifier newProcedure(String name) {
+        return newIdentifier(name, DBIdentifierType.PROCEDURE);
+    }
+
     /**
      * Constructs a new identifier (potentially a compound QualifiedDBIdentifier) with the provided 
      * name an type. Optionally, converting the name to upper case and delimiting it.

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java Thu Aug 18 20:47:20 2016
@@ -910,6 +910,9 @@ public class JDBCStoreManager implements
         if (QueryLanguages.LANG_PREPARED_SQL.equals(language)) {
             return new PreparedSQLStoreQuery(this);
         }
+        if (QueryLanguages.LANG_STORED_PROC.equals(language)) {
+            return new StoredProcedureQuery(this);
+        }
         return null;
     }
     

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java Thu Aug 18 20:47:20 2016
@@ -210,7 +210,7 @@ public class MappingRepository extends M
      * Return the query result mapping for the given name.
      */
     public QueryResultMapping getQueryResultMapping(Class<?> cls, String name, ClassLoader loader, boolean mustExist) {
-        QueryResultMapping res = null;
+        QueryResultMapping res;
         if (_locking) {
             synchronized (this) {
                 res = getQueryResultMappingInternal(cls, name, loader);
@@ -232,13 +232,13 @@ public class MappingRepository extends M
 
         // check cache
         Object key = getQueryResultKey(cls, name);
-        QueryResultMapping res = (QueryResultMapping) _results.get(key);
+        QueryResultMapping res = _results.get(key);
         if (res != null)
             return res;
 
         // get metadata for class, which will find results in metadata file
         if (cls != null && getMetaData(cls, envLoader, false) != null) {
-            res = (QueryResultMapping) _results.get(key);
+            res = _results.get(key);
             if (res != null)
                 return res;
         }
@@ -250,7 +250,7 @@ public class MappingRepository extends M
                     .getResultSetMappingScope(name, envLoader);
         // not in cache; load
         getMetaDataFactory().load(cls, MODE_META | MODE_MAPPING, envLoader);
-        return (QueryResultMapping) _results.get(key);
+        return _results.get(key);
     }
 
     /**

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/QueryResultMapping.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/QueryResultMapping.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/QueryResultMapping.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/QueryResultMapping.java Thu Aug 18 20:47:20 2016
@@ -262,6 +262,7 @@ public class QueryResultMapping
         private Map<List<MetaDataContext>, ColumnMap> _mappings = null;
         private Map<List<MetaDataContext>, FetchInfo> _eager = null; 
         private FetchInfo _fetchInfo = null; // for top-level
+        private Collection<String> _constructorParams = null;
 
         /**
          * Supply candidate type on construction.
@@ -546,6 +547,13 @@ public class QueryResultMapping
                 info.excludes.clear(fm.getIndex());
             }
         }
+
+        public void addConstructorParam(final String name) {
+            if (_constructorParams == null) {
+                _constructorParams = new ArrayList<String>();
+            }
+            _constructorParams.add(name);
+        }
     }
 
     /**

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java Thu Aug 18 20:47:20 2016
@@ -63,6 +63,9 @@ public class Column
     private DBIdentifier _typeName = DBIdentifier.NULL;
     private int _javaType = JavaTypes.OBJECT;
     private int _size = 0;
+    private int _precision = -1;
+    private int _scale     = -1;
+    private int _radix     = 10;
     private int _decimals = 0;
     private String _defaultStr = null;
     private Object _default = null;
@@ -378,6 +381,29 @@ public class Column
         _decimals = digits;
     }
 
+    public int getPrecision() {
+        return _precision;
+    }
+
+    public void setPrecision(int p) {
+        _precision = p;
+    }
+
+    public int getScale() {
+        return _scale;
+    }
+
+    public void setScale(int s) {
+        _scale = s;
+    }
+    public int getRadix() {
+        return _radix;
+    }
+
+    public void setRadix(int r) {
+        _radix = r;
+    }
+
     /**
      * Return the default value set for the column, if any.
      */
@@ -493,6 +519,22 @@ public class Column
     }
 
     /**
+     * Sets nullability of this receiver by the given flag.
+     * @param flag one of the JDBC nullability flag namely
+     * <LI> {@link DatabaseMetaData#columnNullableUnknown} : not known if the column can be set to null value
+     * <LI> {@link DatabaseMetaData#columnNullable} : the column can be set to null value
+     * <LI> {@link DatabaseMetaData#columnNoNulls} : the column can not be set to null value
+     */
+    public void setNullability(short flag) {
+        switch (flag) {
+            case DatabaseMetaData.columnNullableUnknown : _notNull = null; break;
+            case DatabaseMetaData.columnNullable : _notNull = false; break;
+            case DatabaseMetaData.columnNoNulls : _notNull = true; break;
+
+        }
+    }
+
+    /**
      * Whether this column is auto-assigned a value on insert.
      */
     public boolean isAutoAssigned() {
@@ -611,7 +653,7 @@ public class Column
     /**
      * Set the column's 0-based index in the owning table.
      */
-    void setIndex(int index) {
+    public void setIndex(int index) {
         _index = index;
     }
 

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java Thu Aug 18 20:47:20 2016
@@ -60,6 +60,7 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeMap;
 
 import javax.sql.DataSource;
 
@@ -4704,6 +4705,47 @@ public class DBDictionary
         return toDBName(namingUtil.getGeneratedKeySequenceName(col, maxAutoAssignNameLength));
     }
 
+    protected Map<String, StoredProcedure> _procs = new TreeMap<String, StoredProcedure>();
+
+    /**
+     * Gets the metadata of the stored procedure by the given name either from the cached version or
+     * by enquiring the database.
+     * @param meta the database meta data
+     * @param catalog the catalog name or null
+     * @param schema the schema name or null
+     * @param procedure the procedure name
+     * @return metadata about the named procedure or null
+     * @throws SQLException when metadata query goes wrong
+     */
+    public StoredProcedure getStoredProcedure(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schema,
+                                              String procedure) throws SQLException {
+        if (_procs.containsKey(procedure)) {
+            return _procs.get(procedure);
+        }
+        ResultSet rs = meta.getProcedureColumns(
+                getCatalogNameForMetadata(catalog),
+                getSchemaNameForMetadata(schema),
+                procedure,
+                null);
+        StoredProcedure sp = null;
+        if (rs.next()) {
+            sp = new StoredProcedure(rs);
+        } else {
+            ResultSet rsExist = meta.getProcedures(
+                    getCatalogNameForMetadata(catalog),
+                    getSchemaNameForMetadata(schema),
+                    procedure);
+            if (rsExist.next()) {
+                sp = new StoredProcedure((String) null);
+                sp.setCatalog(catalog);
+                sp.setSchema(schema);
+                sp.setName(procedure);
+            }
+        }
+        _procs.put(procedure, sp);
+        return sp;
+    }
+
     ///////////////////////////////
     // Configurable implementation
     ///////////////////////////////

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java Thu Aug 18 20:47:20 2016
@@ -59,6 +59,7 @@ public class ResultSetResult
     private final Statement _stmnt;
     private final ResultSet _rs;
     private final DBDictionary _dict;
+    private boolean _closeStatement = true;
     private boolean _closeConn = true;
     private int _row = -1;
     private int _size = -1;
@@ -178,13 +179,17 @@ public class ResultSetResult
         _closeConn = closeConn;
     }
 
+    public void setCloseStatement(boolean closeStatement) {
+        _closeStatement = closeStatement;
+    }
+
     public void close() {
         super.close();
         try {
             _rs.close();
         } catch (SQLException se) {
         }
-        if (_stmnt != null)
+        if (_stmnt != null && _closeStatement)
             try {
                 _stmnt.close();
             } catch (SQLException se) {

Modified: openjpa/trunk/openjpa-jest/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jest/pom.xml?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jest/pom.xml (original)
+++ openjpa/trunk/openjpa-jest/pom.xml Thu Aug 18 20:47:20 2016
@@ -44,7 +44,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-jpa_2.0_spec</artifactId>
+            <artifactId>geronimo-jpa_2.1_spec</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.openjpa</groupId>

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java Thu Aug 18 20:47:20 2016
@@ -45,6 +45,7 @@ import org.apache.openjpa.kernel.exps.Pa
 import org.apache.openjpa.kernel.exps.QueryExpressions;
 import org.apache.openjpa.kernel.exps.Val;
 import org.apache.openjpa.lib.log.Log;
+import org.apache.openjpa.lib.rop.BatchedResultObjectProvider;
 import org.apache.openjpa.lib.rop.EagerResultList;
 import org.apache.openjpa.lib.rop.ListResultList;
 import org.apache.openjpa.lib.rop.MergedResultObjectProvider;
@@ -1233,6 +1234,9 @@ public class QueryImpl
     protected Object toResult(StoreQuery q, StoreQuery.Executor ex, 
         ResultObjectProvider rop, StoreQuery.Range range)
         throws Exception {
+        if (rop instanceof BatchedResultObjectProvider) {
+            return new QueryResultCallback(this, q, ex, (BatchedResultObjectProvider) rop, range);
+        }
         // pack projections if necessary
         String[] aliases = ex.getProjectionAliases(q);
         if (!ex.isPacking(q)) {

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryLanguages.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryLanguages.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryLanguages.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryLanguages.java Thu Aug 18 20:47:20 2016
@@ -34,6 +34,7 @@ import org.apache.openjpa.util.InternalE
 public class QueryLanguages {
 
     public static final String LANG_SQL = "openjpa.SQL";
+    public static final String LANG_STORED_PROC = "openjpa.StoredProcedure.SQL";
     public static final String LANG_PREPARED_SQL = "openjpa.prepared.SQL";
     public static final String LANG_METHODQL = "openjpa.MethodQL";
 

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java Thu Aug 18 20:47:20 2016
@@ -2002,7 +2002,7 @@ public class MetaDataRepository implemen
             return null;
 
         // check cache
-        QueryMetaData qm = (QueryMetaData) _queries.get(name);
+        QueryMetaData qm = _queries.get(name);
         if (qm != null)
             return qm;
 
@@ -2030,10 +2030,10 @@ public class MetaDataRepository implemen
     public QueryMetaData[] getQueryMetaDatas() {
         if (_locking) {
             synchronized (this) {
-                return (QueryMetaData[]) _queries.values().toArray(new QueryMetaData[_queries.size()]);
+                return _queries.values().toArray(new QueryMetaData[_queries.size()]);
             }
         } else {
-            return (QueryMetaData[]) _queries.values().toArray(new QueryMetaData[_queries.size()]);
+            return _queries.values().toArray(new QueryMetaData[_queries.size()]);
         }
     }
     
@@ -2072,10 +2072,22 @@ public class MetaDataRepository implemen
         }
     }
 
+    public QueryMetaData addQueryMetaData(QueryMetaData meta) {
+        if (_locking) {
+            synchronized (this) {
+                final QueryMetaData queryMetaData = _queries.get(meta.getName());
+                return queryMetaData != null ? queryMetaData : _queries.put(meta.getName(), meta);
+            }
+        } else {
+            final QueryMetaData queryMetaData = _queries.get(meta.getName());
+            return queryMetaData != null ? queryMetaData : _queries.put(meta.getName(), meta);
+        }
+    }
+
     /**
      * Create a new query metadata instance.
      */
-    protected QueryMetaData newQueryMetaData(Class<?> cls, String name) {
+    public QueryMetaData newQueryMetaData(Class<?> cls, String name) {
         QueryMetaData meta =
             new QueryMetaData(name, _conf.getCompatibilityInstance().getConvertPositionalParametersToNamed());
         meta.setDefiningType(cls);
@@ -2118,7 +2130,7 @@ public class MetaDataRepository implemen
      * Searches all cached query metadata by name.
      */
     public QueryMetaData searchQueryMetaDataByName(String name) {        
-        return (QueryMetaData) _queries.get(name);
+        return _queries.get(name);
     }
     
     /**

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/AnnotationPersistenceMappingParser.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/AnnotationPersistenceMappingParser.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/AnnotationPersistenceMappingParser.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/AnnotationPersistenceMappingParser.java Thu Aug 18 20:47:20 2016
@@ -34,6 +34,7 @@ import javax.persistence.AttributeOverri
 import javax.persistence.AttributeOverrides;
 import javax.persistence.CollectionTable;
 import javax.persistence.ColumnResult;
+import javax.persistence.ConstructorResult;
 import javax.persistence.DiscriminatorColumn;
 import javax.persistence.DiscriminatorValue;
 import javax.persistence.EntityResult;
@@ -620,6 +621,9 @@ public class AnnotationPersistenceMappin
                     entityResult.addMapping(field.name(), sColName.getName());
                 }
             }
+            for (ConstructorResult constructorResult : anno.classes()) {
+                throw new UnsupportedOperationException("JPA 2.1, not yet impl");
+            }
             for (ColumnResult column : anno.columns()) {
                 DBIdentifier sName = DBIdentifier.newColumn(column.name(), delimit());
                 result.addColumnResult(sName.getName());

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/MappingTag.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/MappingTag.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/MappingTag.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/MappingTag.java Thu Aug 18 20:47:20 2016
@@ -114,5 +114,5 @@ enum MappingTag {
     X_MAPPING_OVERRIDES,
     X_SECONDARY_TABLE,
     X_SECONDARY_TABLES,
-    X_TABLE,
+    X_TABLE
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/NonstandardMappingEntity.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/NonstandardMappingEntity.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/NonstandardMappingEntity.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/NonstandardMappingEntity.java Thu Aug 18 20:47:20 2016
@@ -28,6 +28,8 @@ import javax.persistence.*;
 import org.apache.openjpa.jdbc.meta.strats.*;
 import org.apache.openjpa.persistence.*;
 import org.apache.openjpa.persistence.jdbc.*;
+import org.apache.openjpa.persistence.jdbc.ForeignKey;
+import org.apache.openjpa.persistence.jdbc.Index;
 import org.apache.openjpa.persistence.jdbc.OrderColumn;
 
 

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/AbstractPersistenceTestCase.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/AbstractPersistenceTestCase.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/AbstractPersistenceTestCase.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/AbstractPersistenceTestCase.java Thu Aug 18 20:47:20 2016
@@ -223,9 +223,9 @@ public abstract class AbstractPersistenc
      * Safely close the given factory.
      */
     protected boolean closeEMF(EntityManagerFactory emf) {
-        boolean brc = false;
+        boolean brc;
         if (emf == null || !emf.isOpen()) {
-            return brc;
+            return false;
         }
         try {
             closeAllOpenEMs(emf);

Modified: openjpa/trunk/openjpa-persistence/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/pom.xml?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/pom.xml (original)
+++ openjpa/trunk/openjpa-persistence/pom.xml Thu Aug 18 20:47:20 2016
@@ -44,7 +44,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-jpa_2.0_spec</artifactId>
+            <artifactId>geronimo-jpa_2.1_spec</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AbstractQuery.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AbstractQuery.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AbstractQuery.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AbstractQuery.java Thu Aug 18 20:47:20 2016
@@ -83,6 +83,10 @@ public abstract class AbstractQuery<X> i
         return result;
     }
 
+    public boolean isProcedure() {
+        return QueryLanguages.LANG_STORED_PROC.equals(getLanguage());
+    }
+
     public boolean isNative() {
         return QueryLanguages.LANG_SQL.equals(getLanguage());
     }
@@ -131,8 +135,8 @@ public abstract class AbstractQuery<X> i
             if (pos < 1) {
                 throw new IllegalArgumentException(_loc.get("illegal-index", pos).getMessage());
             }
-            Parameter<?> param = null;
-            if (isNative()) {
+            Parameter<?> param;
+            if (isNative() || isProcedure()) {
                 param = new ParameterImpl<Object>(pos, Object.class);
                 declareParameter(pos, param);
             } else {

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java Thu Aug 18 20:47:20 2016
@@ -63,6 +63,8 @@ import static org.apache.openjpa.persist
 import static org.apache.openjpa.persistence.MetaDataTag.QUERY;
 import static org.apache.openjpa.persistence.MetaDataTag.READ_ONLY;
 import static org.apache.openjpa.persistence.MetaDataTag.SEQ_GENERATOR;
+import static org.apache.openjpa.persistence.MetaDataTag.STOREDPROCEDURE_QUERIES;
+import static org.apache.openjpa.persistence.MetaDataTag.STOREDPROCEDURE_QUERY;
 import static org.apache.openjpa.persistence.MetaDataTag.TYPE;
 import static org.apache.openjpa.persistence.MetaDataTag.VERSION;
 
@@ -120,9 +122,12 @@ import javax.persistence.NamedNativeQuer
 import javax.persistence.NamedNativeQuery;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
+import javax.persistence.NamedStoredProcedureQueries;
+import javax.persistence.NamedStoredProcedureQuery;
 import javax.persistence.OneToMany;
 import javax.persistence.OneToOne;
 import javax.persistence.OrderBy;
+import javax.persistence.ParameterMode;
 import javax.persistence.PostLoad;
 import javax.persistence.PostPersist;
 import javax.persistence.PostRemove;
@@ -132,6 +137,7 @@ import javax.persistence.PreRemove;
 import javax.persistence.PreUpdate;
 import javax.persistence.QueryHint;
 import javax.persistence.SequenceGenerator;
+import javax.persistence.StoredProcedureParameter;
 import javax.persistence.Version;
 
 import org.apache.commons.lang.StringUtils;
@@ -156,6 +162,7 @@ import org.apache.openjpa.meta.Lifecycle
 import org.apache.openjpa.meta.MetaDataFactory;
 import org.apache.openjpa.meta.MetaDataModes;
 import org.apache.openjpa.meta.MetaDataRepository;
+import org.apache.openjpa.meta.MultiQueryMetaData;
 import org.apache.openjpa.meta.Order;
 import org.apache.openjpa.meta.QueryMetaData;
 import org.apache.openjpa.meta.SequenceMetaData;
@@ -203,6 +210,8 @@ public class AnnotationPersistenceMetaDa
         _tags.put(MapsId.class, MAPPED_BY_ID);
         _tags.put(NamedNativeQueries.class, NATIVE_QUERIES);
         _tags.put(NamedNativeQuery.class, NATIVE_QUERY);
+        _tags.put(NamedStoredProcedureQueries.class, STOREDPROCEDURE_QUERIES);
+        _tags.put(NamedStoredProcedureQuery.class, STOREDPROCEDURE_QUERY);
         _tags.put(NamedQueries.class, QUERIES);
         _tags.put(NamedQuery.class, QUERY);
         _tags.put(OrderBy.class, ORDER_BY);
@@ -471,6 +480,14 @@ public class AnnotationPersistenceMetaDa
                     if (isQueryMode() && (pkgMode & MODE_QUERY) == 0)
                         parseNamedQueries(pkg, (NamedQuery) anno);
                     break;
+                case STOREDPROCEDURE_QUERIES:
+                    if (isQueryMode())
+                        parseNamedStoredProcedureQueries(pkg, ((NamedStoredProcedureQueries) anno).value());
+                    break;
+                case STOREDPROCEDURE_QUERY:
+                    if (isQueryMode())
+                        parseNamedStoredProcedureQueries(pkg, ((NamedStoredProcedureQuery) anno));
+                    break;
                 case SEQ_GENERATOR:
                     if (isMappingOverrideMode() &&
                         (pkgMode & MODE_MAPPING) == 0)
@@ -623,6 +640,14 @@ public class AnnotationPersistenceMetaDa
                     if (isQueryMode() && (meta.getSourceMode() & MODE_QUERY)==0)
                         parseNamedQueries(_cls, (NamedQuery) anno);
                     break;
+                case STOREDPROCEDURE_QUERIES:
+                    if (isQueryMode())
+                        parseNamedStoredProcedureQueries(_cls, ((NamedStoredProcedureQueries) anno).value());
+                    break;
+                case STOREDPROCEDURE_QUERY:
+                    if (isQueryMode())
+                        parseNamedStoredProcedureQueries(_cls, ((NamedStoredProcedureQuery) anno));
+                    break;
                 case SEQ_GENERATOR:
                     if (isMappingOverrideMode())
                         parseSequenceGenerator(_cls, (SequenceGenerator) anno);
@@ -1043,8 +1068,8 @@ public class AnnotationPersistenceMetaDa
      * If FetchGroup A includes FetchGroup B, then a bi-link is set between
      * A and B. Both A and B must be declared in the same Class.
      * <br>
-     * Call {@link #parseFetchAttribute(ClassMetaData,
-     * org.apache.openjpa.meta.FetchGroup, FetchAttribute)} only after the
+     * Call {@link #parseFetchAttribute(ClassMetaData, org.apache.openjpa.meta.FetchGroup, FetchAttributeImpl)}
+     * only after the
      * bi-links have been established, because a field f will not only add the
      * fetch group A which explicitly includes f to its custom fetch groups but
      * also will also add any fetch group B that includes A.
@@ -2128,5 +2153,75 @@ public class AnnotationPersistenceMetaDa
     protected String normalizeCatalogName(String catName) {
         return catName;
     }
+
+
+    protected MultiQueryMetaData.Parameter.Mode toKernelParameterMode(ParameterMode mode) {
+        switch (mode) {
+            case IN : return MultiQueryMetaData.Parameter.Mode.IN;
+            case OUT: return MultiQueryMetaData.Parameter.Mode.OUT;
+            case INOUT: return MultiQueryMetaData.Parameter.Mode.INOUT;
+            case REF_CURSOR: return MultiQueryMetaData.Parameter.Mode.CURSOR;
+            default : return MultiQueryMetaData.Parameter.Mode.IN;
+        }
+    }
+
+    protected void addSourceInfo(AnnotatedElement el, QueryMetaData meta) {
+        meta.setSource(getSourceFile(), (el instanceof Class) ? el : null,
+                SourceTracker.SRC_ANNOTATIONS, getSourceFile() == null ? "" : getSourceFile().getPath());
+        if (isMetaDataMode())
+            meta.setSourceMode(MODE_META);
+        else if (isMappingMode())
+            meta.setSourceMode(MODE_MAPPING);
+        else
+            meta.setSourceMode(MODE_QUERY);
+    }
+
+    protected void addHints(QueryMetaData meta, QueryHint...hints) {
+        for (QueryHint hint : hints)
+            meta.addHint(hint.name(), hint.value());
+
+    }
+
+    private void parseNamedStoredProcedureQueries(AnnotatedElement el, NamedStoredProcedureQuery... procs) {
+        for (NamedStoredProcedureQuery proc : procs) {
+            if (StringUtils.isEmpty(proc.name()))
+                throw new MetaDataException(_loc.get("stored-proc-no-name", el));
+            if (StringUtils.isEmpty(proc.procedureName()))
+                throw new MetaDataException(_loc.get("stored-proc-no-dbname", el));
+
+            // Query metadata name
+            MultiQueryMetaData meta = new MultiQueryMetaData(_cls, proc.name(), proc.procedureName(), false);
+            QueryMetaData existing = getRepository().addQueryMetaData(meta);
+            if (existing != null && existing.getDefiningType() != meta.getDefiningType()) {
+                getLog().warn(_loc.get("dup-query", meta.getName(), el, existing.getDefiningType()));
+            }
+
+            // Important: The query string is the name of the database stored procedure
+            meta.setQueryString(proc.procedureName());
+
+            // For each mapping name/result class, add a component metadata
+            // The spec restricts that either ResultMappingName or ResultClasses be specified, but not both.
+            // This is relevant because the order of mapping must match the order in which the
+            // components are returned
+            Class<?>[] resultClasses = proc.resultClasses();
+            String[] resultSetMappings = proc.resultSetMappings();
+            if (resultClasses.length > 0 && resultSetMappings.length > 0)
+                throw new MetaDataException(_loc.get("stored-proc-both-mapping", el));
+            for (Class<?> res : resultClasses) {
+                meta.addComponent(res);
+            }
+            for (String mapping : resultSetMappings) {
+                meta.addComponent(mapping);
+            }
+            StoredProcedureParameter[] params = proc.parameters();
+            for (StoredProcedureParameter param : params) {
+                MultiQueryMetaData.Parameter p = new MultiQueryMetaData.Parameter(
+                        param.name(), param.type(), toKernelParameterMode(param.mode()));
+                meta.registerParameter(p);
+            }
+            addHints(meta, proc.hints());
+            addSourceInfo(el, meta);
+        }
+    }
 }
 

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java Thu Aug 18 20:47:20 2016
@@ -25,9 +25,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
-import javax.persistence.Cache;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.PersistenceUnitUtil;
+import javax.persistence.*;
 import javax.persistence.spi.LoadState;
 
 import org.apache.commons.lang.StringUtils;
@@ -44,6 +42,7 @@ import org.apache.openjpa.lib.log.Log;
 import org.apache.openjpa.lib.util.Closeable;
 import org.apache.openjpa.lib.util.Localizer;
 import org.apache.openjpa.meta.MetaDataRepository;
+import org.apache.openjpa.meta.QueryMetaData;
 import org.apache.openjpa.persistence.criteria.CriteriaBuilderImpl;
 import org.apache.openjpa.persistence.criteria.OpenJPACriteriaBuilder;
 import org.apache.openjpa.persistence.meta.MetamodelImpl;
@@ -150,7 +149,7 @@ public class EntityManagerFactoryImpl
     }
 
     public OpenJPAEntityManagerSPI createEntityManager() {
-        return createEntityManager(null);
+        return createEntityManager((Map) null);
     }
 
     /**
@@ -242,7 +241,17 @@ public class EntityManagerFactoryImpl
         }
         return em;
     }
-    
+
+    @Override
+    public EntityManager createEntityManager(SynchronizationType synchronizationType) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
+    @Override
+    public EntityManager createEntityManager(SynchronizationType synchronizationType, Map map) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
     /**
      * Create a new entity manager around the given broker.
      */
@@ -354,6 +363,28 @@ public class EntityManagerFactoryImpl
         return this;
     }
 
+    @Override
+    public void addNamedQuery(String name, Query query) {
+        org.apache.openjpa.kernel.Query kernelQuery = ((QueryImpl<?>)query).getDelegate();
+        MetaDataRepository metaDataRepositoryInstance = _factory.getConfiguration().getMetaDataRepositoryInstance();
+        QueryMetaData metaData = metaDataRepositoryInstance.newQueryMetaData(null, null);
+        metaData.setFrom(kernelQuery);
+        metaDataRepositoryInstance.addQueryMetaData(metaData);
+    }
+
+    @Override
+    public <T> T unwrap(Class<T> cls) {
+        if (cls.isInstance(this)) {
+            return cls.cast(this);
+        }
+        throw new javax.persistence.PersistenceException(this + " is not a " + cls);
+    }
+
+    @Override
+    public <T> void addNamedEntityGraph(String graphName, EntityGraph<T> entityGraph) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
     /**
      * Get the identifier for the specified entity.  If not managed by any
      * of the em's in this PU or not persistence capable, return null.

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java Thu Aug 18 20:47:20 2016
@@ -36,19 +36,24 @@ import java.util.Collection;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.IdentityHashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import javax.persistence.CacheRetrieveMode;
 import javax.persistence.CacheStoreMode;
+import javax.persistence.EntityGraph;
 import javax.persistence.EntityManager;
 import javax.persistence.FlushModeType;
 import javax.persistence.LockModeType;
 import javax.persistence.PessimisticLockScope;
 import javax.persistence.Query;
+import javax.persistence.StoredProcedureQuery;
 import javax.persistence.Tuple;
 import javax.persistence.TypedQuery;
+import javax.persistence.criteria.CriteriaDelete;
 import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.CriteriaUpdate;
 import javax.persistence.criteria.ParameterExpression;
 import javax.persistence.metamodel.Metamodel;
 
@@ -79,6 +84,8 @@ import org.apache.openjpa.lib.util.Close
 import org.apache.openjpa.lib.util.Localizer;
 import org.apache.openjpa.meta.ClassMetaData;
 import org.apache.openjpa.meta.FieldMetaData;
+import org.apache.openjpa.meta.MetaDataRepository;
+import org.apache.openjpa.meta.MultiQueryMetaData;
 import org.apache.openjpa.meta.QueryMetaData;
 import org.apache.openjpa.meta.SequenceMetaData;
 import org.apache.openjpa.persistence.criteria.CriteriaBuilderImpl;
@@ -116,7 +123,8 @@ public class EntityManagerImpl
     private Map<FetchConfiguration,FetchPlan> _plans = new IdentityHashMap<FetchConfiguration,FetchPlan>(1);
     protected RuntimeExceptionTranslator _ret = PersistenceExceptions.getRollbackTranslator(this);
     private boolean _convertPositionalParams = false;
-    
+    private boolean _isJoinedToTransaction;
+
     public EntityManagerImpl() {
         // for Externalizable
     }
@@ -556,12 +564,24 @@ public class EntityManagerImpl
     }
 
     public void joinTransaction() {
+        if (!_broker.syncWithManagedTransaction()) {
+            throw new TransactionRequiredException(_loc.get
+                    ("no-managed-trans"), null, null, false);
+        } else {
+            _isJoinedToTransaction = true;
+        }
+
         assertNotCloseInvoked();
         if (!_broker.syncWithManagedTransaction())
             throw new TransactionRequiredException(_loc.get
                 ("no-managed-trans"), null, null, false);
     }
 
+    @Override
+    public boolean isJoinedToTransaction() {
+        return isActive() && _isJoinedToTransaction;
+    }
+
     public void begin() {
         _broker.begin();
     }
@@ -1077,6 +1097,64 @@ public class EntityManagerImpl
         return newQueryImpl(kernelQuery, null);
     }
 
+    @Override
+    public StoredProcedureQuery createNamedStoredProcedureQuery(String name) {
+        QueryMetaData meta = getQueryMetadata(name);
+        if (!MultiQueryMetaData.class.isInstance(meta)) {
+            throw new RuntimeException(name + " is not an identifier for a Stored Procedure Query");
+        }
+        return newProcedure(((MultiQueryMetaData)meta).getProcedureName(), (MultiQueryMetaData)meta);
+    }
+
+    @Override
+    public StoredProcedureQuery createStoredProcedureQuery(String procedureName) {
+        return newProcedure(procedureName, null);
+    }
+
+    @Override
+    public StoredProcedureQuery createStoredProcedureQuery(String procedureName, Class... resultClasses) {
+        String tempName = "StoredProcedure-"+System.nanoTime();
+        MultiQueryMetaData meta = new MultiQueryMetaData(null, tempName, procedureName, true);
+        for (Class<?> res : resultClasses) {
+            meta.addComponent(res);
+        }
+        return newProcedure(procedureName, meta);
+    }
+
+    @Override
+    public StoredProcedureQuery createStoredProcedureQuery(String procedureName, String... resultSetMappings) {
+        String tempName = "StoredProcedure-"+System.nanoTime();
+        MultiQueryMetaData meta = new MultiQueryMetaData(null, tempName, procedureName, true);
+        for (String mapping : resultSetMappings) {
+            meta.addComponent(mapping);
+        }
+        return newProcedure(procedureName, meta);
+    }
+
+    /**
+     * Creates a query to execute a Stored Procedure.
+     * <br>
+     * Construction of a {@link StoredProcedureQuery} object is a three step process
+     * <LI>
+     * <LI>a {@link org.apache.openjpa.kernel.Query kernel query} {@code kQ} is created for
+     * {@link QueryLanguages#LANG_SQL SQL} language with the string {@code S}
+     * <LI>a {@link QueryImpl facade query} {@code fQ} is created that delegates to the kernel query {@code kQ}
+     * <LI>a {@link StoredProcedureQueryImpl stored procedure query} is created that delegates to the facade query
+     * {@code fQ}.
+     * <br>
+     *
+     */
+    private StoredProcedureQuery newProcedure(String procedureName, MultiQueryMetaData meta) {
+        org.apache.openjpa.kernel.QueryImpl kernelQuery = (org.apache.openjpa.kernel.QueryImpl)
+                _broker.newQuery(QueryLanguages.LANG_STORED_PROC, procedureName);
+        kernelQuery.getStoreQuery().setQuery(meta);
+        if (meta != null) {
+            getConfiguration().getMetaDataRepositoryInstance().addQueryMetaData(meta);
+            kernelQuery.setResultMapping(null, meta.getResultSetMappingName());
+        }
+        return new StoredProcedureQueryImpl(procedureName, meta, new QueryImpl(this, _ret, kernelQuery, meta));
+    }
+
     protected <T> QueryImpl<T> newQueryImpl(org.apache.openjpa.kernel.Query kernelQuery, QueryMetaData qmd) {
         return new QueryImpl<T>(this, _ret, kernelQuery, qmd);
     }
@@ -1633,7 +1711,17 @@ public class EntityManagerImpl
         }
         return facadeQuery;
     }
-    
+
+    @Override
+    public Query createQuery(CriteriaUpdate updateQuery) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
+    @Override
+    public Query createQuery(CriteriaDelete deleteQuery) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
     public OpenJPAQuery createDynamicQuery(
         org.apache.openjpa.persistence.query.QueryDefinition qdef) {
         String jpql = _emf.getDynamicQueryBuilder().toJPQL(qdef);
@@ -1790,6 +1878,26 @@ public class EntityManagerImpl
         return _emf.getMetamodel();
     }
 
+    @Override
+    public <T> EntityGraph<T> createEntityGraph(Class<T> rootType) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
+    @Override
+    public EntityGraph<?> createEntityGraph(String graphName) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
+    @Override
+    public EntityGraph<?>   getEntityGraph(String graphName) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
+    @Override
+    public <T> List<EntityGraph<? super T>> getEntityGraphs(Class<T> entityClass) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
     /**
      * Sets the given property to the given value, reflectively.
      * 
@@ -1892,4 +2000,13 @@ public class EntityManagerImpl
         }
         return properties;
     }
+
+    private QueryMetaData getQueryMetadata(String name) {
+        MetaDataRepository repos = _broker.getConfiguration().getMetaDataRepositoryInstance();
+        QueryMetaData meta = repos.getQueryMetaData(null, name, _broker.getClassLoader(), true);
+        if (meta == null) {
+            throw new RuntimeException("No query named [" + name + "]");
+        }
+        return meta;
+    }
 }

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MetaDataTag.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MetaDataTag.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MetaDataTag.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MetaDataTag.java Thu Aug 18 20:47:20 2016
@@ -88,5 +88,8 @@ public enum MetaDataTag {
     READ_ONLY,
     TYPE,
     REPLICATED,
-    OPENJPA_VERSION
+    OPENJPA_VERSION,
+    // JPA 2.1
+    STOREDPROCEDURE_QUERIES,
+    STOREDPROCEDURE_QUERY
 }

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java Thu Aug 18 20:47:20 2016
@@ -20,6 +20,7 @@ package org.apache.openjpa.persistence;
 
 import java.io.File;
 import java.io.IOException;
+import java.lang.annotation.Annotation;
 import java.net.URL;
 import java.security.AccessController;
 import java.util.ArrayList;
@@ -39,6 +40,8 @@ import javax.persistence.NamedNativeQuer
 import javax.persistence.NamedNativeQuery;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
+import javax.persistence.NamedStoredProcedureQueries;
+import javax.persistence.NamedStoredProcedureQuery;
 import javax.persistence.SqlResultSetMapping;
 import javax.persistence.SqlResultSetMappings;
 import javax.persistence.metamodel.StaticMetamodel;
@@ -371,10 +374,20 @@ public class PersistenceMetaDataFactory
                 hasNamedNativeQuery(queryName, ((NamedNativeQueries) cls.
                     getAnnotation(NamedNativeQueries.class)).value()))
                 return cls;
+            if (isAnnotated(cls, NamedStoredProcedureQuery.class)
+                    && hasNamedStoredProcedure(queryName, cls.getAnnotation(NamedStoredProcedureQuery.class)))
+                return cls;
+            if (isAnnotated(cls, NamedStoredProcedureQueries.class)
+                    && hasNamedStoredProcedure(queryName, cls.getAnnotation(NamedStoredProcedureQueries.class).value()))
+                return cls;
         }
         return null;
     }
 
+    private boolean isAnnotated(Class<?> cls, Class<? extends Annotation> annotationClazz) {
+        return AccessController.doPrivileged(J2DoPrivHelper.isAnnotationPresentAction(cls, annotationClazz));
+    }
+
     @Override
     public Class<?> getResultSetMappingScope(String rsMappingName,
         ClassLoader loader) {
@@ -416,6 +429,14 @@ public class PersistenceMetaDataFactory
                 return true;
         }
         return false;
+    }
+
+    private boolean hasNamedStoredProcedure(String query, NamedStoredProcedureQuery... queries) {
+        for (NamedStoredProcedureQuery q : queries) {
+            if (query.equals(q.name()))
+                return true;
+        }
+        return false;
     }
 
     private boolean hasNamedNativeQuery(String query,

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java Thu Aug 18 20:47:20 2016
@@ -220,6 +220,16 @@ public class PersistenceProviderImpl
         }
     }
 
+    @Override
+    public void generateSchema(PersistenceUnitInfo info, Map map) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
+    @Override
+    public boolean generateSchema(String persistenceUnitName, Map map) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
     public void setPersistenceEnvironmentInfo(OpenJPAConfiguration conf, PersistenceUnitInfo pui) {
         // OPENJPA-1460 Fix scope visibility of orm.xml when it is packaged in both ear file and war file
         if (conf instanceof OpenJPAConfigurationImpl) {

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/StoreCacheImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/StoreCacheImpl.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/StoreCacheImpl.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/StoreCacheImpl.java Thu Aug 18 20:47:20 2016
@@ -129,7 +129,15 @@ public class StoreCacheImpl
     public void evictAll() {
         _cache.clear();
     }
-    
+
+    @Override
+    public <T> T unwrap(Class<T> cls) {
+        if (cls.isInstance(this)) {
+            return cls.cast(this);
+        }
+        throw new javax.persistence.PersistenceException(cls.getName() + " not supported");
+    }
+
     public CacheStatistics getStatistics() {
     	return (_cache == null) ? null : _cache.getStatistics();
     }

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java Thu Aug 18 20:47:20 2016
@@ -601,7 +601,7 @@ public class XMLPersistenceMetaDataParse
     @Override
     protected boolean startSystemElement(String name, Attributes attrs)
         throws SAXException {
-        Object tag = (Object) _elems.get(name);
+        Object tag = _elems.get(name);
         boolean ret = false;
         if (tag == null) {
             if (isMappingOverrideMode())

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaBuilderImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaBuilderImpl.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaBuilderImpl.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaBuilderImpl.java Thu Aug 18 20:47:20 2016
@@ -29,13 +29,22 @@ import java.util.Map;
 import java.util.Set;
 
 import javax.persistence.Tuple;
+import javax.persistence.criteria.CollectionJoin;
 import javax.persistence.criteria.CompoundSelection;
+import javax.persistence.criteria.CriteriaDelete;
+import javax.persistence.criteria.CriteriaUpdate;
 import javax.persistence.criteria.Expression;
 import javax.persistence.criteria.From;
+import javax.persistence.criteria.Join;
+import javax.persistence.criteria.ListJoin;
+import javax.persistence.criteria.MapJoin;
 import javax.persistence.criteria.Order;
 import javax.persistence.criteria.ParameterExpression;
+import javax.persistence.criteria.Path;
 import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
 import javax.persistence.criteria.Selection;
+import javax.persistence.criteria.SetJoin;
 import javax.persistence.criteria.Subquery;
 import javax.persistence.criteria.Predicate.BooleanOperator;
 import javax.persistence.metamodel.Attribute;
@@ -108,6 +117,16 @@ public class CriteriaBuilderImpl impleme
         return new CriteriaQueryImpl<Tuple>(_model, Tuple.class);
     }
 
+    @Override
+    public <T> CriteriaUpdate<T> createCriteriaUpdate(Class<T> targetEntity) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
+    @Override
+    public <T> CriteriaDelete<T> createCriteriaDelete(Class<T> targetEntity) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
     public Object parse(String ql, ExpressionStoreQuery query) {
         throw new AbstractMethodError();
     }
@@ -252,6 +271,41 @@ public class CriteriaBuilderImpl impleme
         return new Expressions.DatabaseFunction(name, type, args);
     }
 
+    @Override
+    public <X, T, V extends T> Join<X, V> treat(Join<X, T> join, Class<V> type) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
+    @Override
+    public <X, T, E extends T> CollectionJoin<X, E> treat(CollectionJoin<X, T> join, Class<E> type) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
+    @Override
+    public <X, T, E extends T> SetJoin<X, E> treat(SetJoin<X, T> join, Class<E> type) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
+    @Override
+    public <X, T, E extends T> ListJoin<X, E> treat(ListJoin<X, T> join, Class<E> type) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
+    @Override
+    public <X, K, T, V extends T> MapJoin<X, K, V> treat(MapJoin<X, K, T> join, Class<V> type) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
+    @Override
+    public <X, T extends X> Path<T> treat(Path<X> path, Class<T> type) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
+    @Override
+    public <X, T extends X> Root<T> treat(Root<X> root, Class<T> type) {
+        throw new UnsupportedOperationException("JPA 2.1");
+    }
+
     public Predicate ge(Expression<? extends Number> x,
         Expression<? extends Number> y) {
         return new Expressions.GreaterThanEqual(x,y);

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Joins.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Joins.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Joins.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Joins.java Thu Aug 18 20:47:20 2016
@@ -29,6 +29,7 @@ import javax.persistence.criteria.ListJo
 import javax.persistence.criteria.MapJoin;
 import javax.persistence.criteria.Path;
 import javax.persistence.criteria.PluralJoin;
+import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.SetJoin;
 import javax.persistence.metamodel.Attribute;
 import javax.persistence.metamodel.CollectionAttribute;
@@ -138,7 +139,22 @@ abstract class Joins {
         public Member<? extends Z, X> getMember() {
             return (Member<? extends Z, X>) _member;
         }
-        
+
+        @Override
+        public Join<Z, X> on(Expression<Boolean> restriction) {
+            throw new UnsupportedOperationException("JPA 2.1");
+        }
+
+        @Override
+        public Join<Z, X> on(Predicate... restrictions) {
+            throw new UnsupportedOperationException("JPA 2.1");
+        }
+
+        @Override
+        public Predicate getOn() {
+            throw new UnsupportedOperationException("JPA 2.1");
+        }
+
         /**
          * Return the metamodel attribute corresponding to the join.
          * @return metamodel attribute type corresponding to the join
@@ -495,7 +511,22 @@ abstract class Joins {
         public Collection(FromImpl<?,Z> parent, Members.CollectionAttributeImpl<? super Z, E> member, JoinType jt) {
             super(parent, member, jt);
         }
-        
+
+        @Override
+        public CollectionJoin<Z, E> on(Expression<Boolean> restriction) {
+            throw new UnsupportedOperationException("JPA 2.1");
+        }
+
+        @Override
+        public CollectionJoin<Z, E> on(Predicate... restrictions) {
+            throw new UnsupportedOperationException("JPA 2.1");
+        }
+
+        @Override
+        public Predicate getOn() {
+            throw new UnsupportedOperationException("JPA 2.1");
+        }
+
         public CollectionAttribute<? super Z, E> getModel() {
             return (CollectionAttribute<? super Z, E>)_member;
         }
@@ -512,7 +543,22 @@ abstract class Joins {
         public Set(FromImpl<?,Z> parent, Members.SetAttributeImpl<? super Z, E> member, JoinType jt) {
             super(parent, member, jt);
         }
-        
+
+        @Override
+        public SetJoin<Z, E> on(Expression<Boolean> restriction) {
+            throw new UnsupportedOperationException("JPA 2.1");
+        }
+
+        @Override
+        public SetJoin<Z, E> on(Predicate... restrictions) {
+            throw new UnsupportedOperationException("JPA 2.1");
+        }
+
+        @Override
+        public Predicate getOn() {
+            throw new UnsupportedOperationException("JPA 2.1");
+        }
+
         public SetAttribute<? super Z, E> getModel() {
             return (SetAttribute<? super Z, E>)_member;
         }
@@ -531,7 +577,22 @@ abstract class Joins {
         public List(FromImpl<?,Z> parent, Members.ListAttributeImpl<? super Z, E> member, JoinType jt) {
             super(parent, member, jt);
         }
-        
+
+        @Override
+        public ListJoin<Z, E> on(Expression<Boolean> restriction) {
+            throw new UnsupportedOperationException("JPA 2.1");
+        }
+
+        @Override
+        public ListJoin<Z, E> on(Predicate... restrictions) {
+            throw new UnsupportedOperationException("JPA 2.1");
+        }
+
+        @Override
+        public Predicate getOn() {
+            throw new UnsupportedOperationException("JPA 2.1");
+        }
+
         public ListAttribute<? super Z, E> getModel() {
             return (ListAttribute<? super Z, E>)_member;
         }
@@ -556,7 +617,22 @@ abstract class Joins {
         public Map(FromImpl<?,Z> parent, Members.MapAttributeImpl<? super Z, K,V> member, JoinType jt) {
             super(parent, member, jt);
         }
-        
+
+        @Override
+        public MapJoin<Z, K, V> on(Expression<Boolean> restriction) {
+            throw new UnsupportedOperationException("JPA 2.1");
+        }
+
+        @Override
+        public MapJoin<Z, K, V> on(Predicate... restrictions) {
+            throw new UnsupportedOperationException("JPA 2.1");
+        }
+
+        @Override
+        public Predicate getOn() {
+            throw new UnsupportedOperationException("JPA 2.1");
+        }
+
         public MapAttribute<? super Z, K,V> getModel() {
             return (MapAttribute<? super Z, K,V>) _member;
         }

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/SubqueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/SubqueryImpl.java?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/SubqueryImpl.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/SubqueryImpl.java Thu Aug 18 20:47:20 2016
@@ -27,6 +27,7 @@ import java.util.concurrent.CopyOnWriteA
 
 import javax.persistence.criteria.AbstractQuery;
 import javax.persistence.criteria.CollectionJoin;
+import javax.persistence.criteria.CommonAbstractCriteria;
 import javax.persistence.criteria.Expression;
 import javax.persistence.criteria.Join;
 import javax.persistence.criteria.ListJoin;
@@ -94,7 +95,12 @@ class SubqueryImpl<T> extends Expression
     public AbstractQuery<?> getParent() {
         return _parent;
     }
-    
+
+    @Override
+    public CommonAbstractCriteria getContainingQuery() {
+        return getParent();
+    }
+
     /**
      * Gets the captive query to which this subquery delegates.
      */

Modified: openjpa/trunk/openjpa-project/assembly.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/assembly.xml?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/assembly.xml (original)
+++ openjpa/trunk/openjpa-project/assembly.xml Thu Aug 18 20:47:20 2016
@@ -140,7 +140,7 @@
                 <include>commons-dbcp:commons-dbcp</include>
 
                 <include>org.apache.geronimo.specs:geronimo-jta_1.1_spec</include>
-                <include>org.apache.geronimo.specs:geronimo-jpa_2.0_spec</include>
+                <include>org.apache.geronimo.specs:geronimo-jpa_2.1_spec</include>
                 <include>org.apache.geronimo.specs:geronimo-jms_1.1_spec</include>
                 <include>org.apache.geronimo.specs:geronimo-validation_1.0_spec</include>
                 <include>org.apache.bval:org.apache.bval.bundle</include>

Modified: openjpa/trunk/openjpa-project/bin-assembly.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/bin-assembly.xml?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/bin-assembly.xml (original)
+++ openjpa/trunk/openjpa-project/bin-assembly.xml Thu Aug 18 20:47:20 2016
@@ -79,7 +79,7 @@
                 <include>commons-dbcp:commons-dbcp</include>
 
                 <include>org.apache.geronimo.specs:geronimo-jta_1.1_spec</include>
-                <include>org.apache.geronimo.specs:geronimo-jpa_2.0_spec</include>
+                <include>org.apache.geronimo.specs:geronimo-jpa_2.1_spec</include>
                 <include>org.apache.geronimo.specs:geronimo-jms_1.1_spec</include>
                 <include>org.apache.geronimo.specs:geronimo-validation_1.0_spec</include>
                 <include>org.apache.bval:org.apache.bval.bundle</include>

Modified: openjpa/trunk/openjpa-slice/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-slice/pom.xml?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-slice/pom.xml (original)
+++ openjpa/trunk/openjpa-slice/pom.xml Thu Aug 18 20:47:20 2016
@@ -49,7 +49,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-jpa_2.0_spec</artifactId>
+            <artifactId>geronimo-jpa_2.1_spec</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>

Modified: openjpa/trunk/openjpa-tools/openjpa-fetch-statistics/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/openjpa-fetch-statistics/pom.xml?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-tools/openjpa-fetch-statistics/pom.xml (original)
+++ openjpa/trunk/openjpa-tools/openjpa-fetch-statistics/pom.xml Thu Aug 18 20:47:20 2016
@@ -30,7 +30,7 @@
 	<dependencies>
 		<dependency>
 			<groupId>org.apache.geronimo.specs</groupId>
-			<artifactId>geronimo-jpa_2.0_spec</artifactId>
+			<artifactId>geronimo-jpa_2.1_spec</artifactId>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.geronimo.specs</groupId>

Modified: openjpa/trunk/openjpa-tools/openjpa-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/openjpa-maven-plugin/pom.xml?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-tools/openjpa-maven-plugin/pom.xml (original)
+++ openjpa/trunk/openjpa-tools/openjpa-maven-plugin/pom.xml Thu Aug 18 20:47:20 2016
@@ -115,7 +115,7 @@
 
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-jpa_2.0_spec</artifactId>
+            <artifactId>geronimo-jpa_2.1_spec</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>

Modified: openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/pom.xml?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/pom.xml (original)
+++ openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/pom.xml Thu Aug 18 20:47:20 2016
@@ -37,7 +37,7 @@
 
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-jpa_2.0_spec</artifactId>
+            <artifactId>geronimo-jpa_2.1_spec</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>

Modified: openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/dependingArtifact/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/dependingArtifact/pom.xml?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/dependingArtifact/pom.xml (original)
+++ openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/dependingArtifact/pom.xml Thu Aug 18 20:47:20 2016
@@ -43,7 +43,7 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-jpa_2.0_spec</artifactId>
+            <artifactId>geronimo-jpa_2.1_spec</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>

Modified: openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/enhanceIncludesExcludes/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/enhanceIncludesExcludes/pom.xml?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/enhanceIncludesExcludes/pom.xml (original)
+++ openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/enhanceIncludesExcludes/pom.xml Thu Aug 18 20:47:20 2016
@@ -37,7 +37,7 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-jpa_2.0_spec</artifactId>
+            <artifactId>geronimo-jpa_2.1_spec</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>

Modified: openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/nonDefaultPersistenceXml/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/nonDefaultPersistenceXml/pom.xml?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/nonDefaultPersistenceXml/pom.xml (original)
+++ openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/nonDefaultPersistenceXml/pom.xml Thu Aug 18 20:47:20 2016
@@ -36,7 +36,7 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-jpa_2.0_spec</artifactId>
+            <artifactId>geronimo-jpa_2.1_spec</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>

Modified: openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/sqlActionDropSchema/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/sqlActionDropSchema/pom.xml?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/sqlActionDropSchema/pom.xml (original)
+++ openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/sqlActionDropSchema/pom.xml Thu Aug 18 20:47:20 2016
@@ -36,7 +36,7 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-jpa_2.0_spec</artifactId>
+            <artifactId>geronimo-jpa_2.1_spec</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>

Modified: openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/testDependencies/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/testDependencies/pom.xml?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/testDependencies/pom.xml (original)
+++ openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/testDependencies/pom.xml Thu Aug 18 20:47:20 2016
@@ -36,7 +36,7 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-jpa_2.0_spec</artifactId>
+            <artifactId>geronimo-jpa_2.1_spec</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>

Modified: openjpa/trunk/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/pom.xml?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/pom.xml (original)
+++ openjpa/trunk/pom.xml Thu Aug 18 20:47:20 2016
@@ -524,8 +524,8 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.geronimo.specs</groupId>
-                <artifactId>geronimo-jpa_2.0_spec</artifactId>
-                <version>1.1</version>
+                <artifactId>geronimo-jpa_2.1_spec</artifactId>
+                <version>1.0-SNAPSHOT</version>
             </dependency>
             <dependency>
                 <groupId>org.apache.geronimo.specs</groupId>

Modified: openjpa/trunk/scripts/mmg.bat
URL: http://svn.apache.org/viewvc/openjpa/trunk/scripts/mmg.bat?rev=1756850&r1=1756849&r2=1756850&view=diff
==============================================================================
--- openjpa/trunk/scripts/mmg.bat (original)
+++ openjpa/trunk/scripts/mmg.bat Thu Aug 18 20:47:20 2016
@@ -40,7 +40,7 @@ set JAVAC=%JAVA_HOME%\bin\javac
 @rem Compiler classpath shown for a typical OpenJPA development environment in Windows. 
 @rem The essential aspect is openjpa libraries must be in the compiler's classpath.
 set M_REPO="%USERPROFILE%\.m2\repository"
-set SPEC=geronimo-jpa_2.0_spec
+set SPEC=geronimo-jpa_2.1_spec
 set VERSION=1.0-EA9-SNAPSHOT
 set JPA_LIB=%M_REPO%\org\apache\geronimo\specs\%SPEC%\%VERSION%\%SPEC%-%VERSION%.jar
 



Mime
View raw message