|
Description
Gordon Yorke
Created attachment 210740 [details] Progress patch This is a progress patch of this feature. It is not complete and more patches to follow. This patch includes: - Named stored procedure query support though annotations and xml - Code changes for bug 350727 - EclipseLink project configurations - New JPA 2.1 test target and jars - Antbuild.xml changes The only changes of note for me are: - change the IDE to use a variable to point to the lib rather than a direct link. Great! - you re-define the javax.persistence20 variable to point to the 2.1 jar. Because 2.4.0 may support 10, 2.0, and 2.1 preview. I'd prefer adding a javax.persistence21 variable and changing the classpath dependencies to point to it for now. At the point we remove 1.0 as an option we should be able to simply remove that variable and update references to it rather than reworking the build to allow 2.1/2.0 rather than 2.1/1.0. I could do the work and hand it to you, or do it post-merge, or you could do it. Another thing is that eventually we will need to change the eclipselink.jar packaging to change the included classes. If I'm to do that post-merge, I'll need a list of classes that are new to 2.1. I'm not certain what the ramifications will be for testing to leave the jar as is and run 1.0 tests Created attachment 210921 [details]
Updated progress patch
Created attachment 210972 [details]
Missed resource files from previous patch
Created attachment 211008 [details]
EclipseLink jar build changes, adding new JPA 2.1 classes
Created attachment 211108 [details]
Small update to fix test failure from nightlies.
Created attachment 211139 [details]
Updating some tests to run on MySQL only
Created attachment 212291 [details]
Removing JPA 2.1 classes from Eclipselink jar
Created attachment 217279 [details]
Progress patch
Includes:
- Entity Manager create stored procedure query API
- Entity Manager register parameter API
- Clean up of metadata processing of queries.
- No need to pass the class loader around as it is already available for all ORMetadata objects
- Channel class loading through existing ORMetadata getJavaClass method
- Added new tests
- Remove unused code
Created attachment 217750 [details]
Update patch to JPA 2.1 APIs
Created attachment 218707 [details]
Progress patch (July 13)
Created attachment 220221 [details]
Progress patch (August 23)
Created attachment 220223 [details]
Progress patch (August 23)
Created attachment 220969 [details]
Update to last progress patch
After review from Gordon Yorke
Created attachment 221045 [details]
Progress patch (Sept 13)
Comment on attachment 220969 [details] Update to last progress patch >From d42cceaaf0139019b5b9947598a79a44e0581b8b Mon Sep 17 00:00:00 2001 >From: gpelletie <guy.pelletier@oracle.com> >Date: Wed, 12 Sep 2012 08:49:53 -0400 >Subject: [PATCH 2/2] Bug 350487 - JPA 2.1 Specification defined support for > Stored Procedure Calls > >Update after review of last patch by Gordon Yorke >--- > .../NamedStoredProcedureQueryTestSuite.java | 5 +-- > .../internal/jpa/EntityManagerImpl.java | 28 ++++++++++------ > .../internal/jpa/StoredProcedureQueryImpl.java | 37 ++++++++++++++-------- > 3 files changed, 45 insertions(+), 25 deletions(-) > >diff --git a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa21/advanced/NamedStoredProcedureQueryTestSuite.java b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa21/advanced/NamedStoredProcedureQueryTestSuite.java >index e5fe3fa..61a6bbc 100644 >--- a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa21/advanced/NamedStoredProcedureQueryTestSuite.java >+++ b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa21/advanced/NamedStoredProcedureQueryTestSuite.java >@@ -16,6 +16,8 @@ > * - 350487: JPA 2.1 Specification defined support for Stored Procedure Calls > * 08/24/2012-2.5 Guy Pelletier > * - 350487: JPA 2.1 Specification defined support for Stored Procedure Calls >+ * 09/12/2012-2.5 Guy Pelletier >+ * - 350487: JPA 2.1 Specification defined support for Stored Procedure Calls > ******************************************************************************/ > package org.eclipse.persistence.testing.tests.jpa21.advanced; > >@@ -441,8 +443,7 @@ public class NamedStoredProcedureQueryTestSuite extends JUnitTestCase { > > List<Address> addressResults = query.getResultList(); > >- // Should return true (employees to return) >- assertTrue("The query did not have more results (Employees).", query.hasMoreResults()); >+ // We know there should be more results so ask for them without checking for has more results. > List<Employee> employeeResults = query.getResultList(); > int numberOfEmployes = employeeResults.size(); > >diff --git a/jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/EntityManagerImpl.java b/jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/EntityManagerImpl.java >index b794407..fe27f36 100644 >--- a/jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/EntityManagerImpl.java >+++ b/jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/EntityManagerImpl.java >@@ -29,9 +29,12 @@ > * - 350487: JPA 2.1 Specification defined support for Stored Procedure Calls > * 08/24/2012-2.5 Guy Pelletier > * - 350487: JPA 2.1 Specification defined support for Stored Procedure Calls >+ * 09/12/2012-2.5 Guy Pelletier >+ * - 350487: JPA 2.1 Specification defined support for Stored Procedure Calls > ******************************************************************************/ > package org.eclipse.persistence.internal.jpa; > >+import java.lang.ref.WeakReference; > import java.util.*; > > import javax.persistence.*; >@@ -143,7 +146,7 @@ public class EntityManagerImpl implements org.eclipse.persistence.jpa.JpaEntityM > /** > * Keep a list of openQueries that are executed in this entity manager. > */ >- protected List<QueryImpl> openQueries; >+ protected WeakReference<List<QueryImpl>> openQueriesReference; > > /** > * Property to avoid resuming unit of work if going to be closed on commit >@@ -297,6 +300,17 @@ public class EntityManagerImpl implements org.eclipse.persistence.jpa.JpaEntityM > } > > >+ /** >+ * Return the weak reference to the open queries. >+ */ >+ protected List<QueryImpl> getOpenQueries() { >+ if (openQueriesReference == null || openQueriesReference.get() == null) { >+ openQueriesReference = new WeakReference<List<QueryImpl>>(new ArrayList<QueryImpl>()); >+ } >+ >+ return openQueriesReference.get(); >+ } >+ > /** > * Queries that leave the connection and are executed against this entity > * manager will be added here. On rollback or commit any left over open >@@ -305,11 +319,7 @@ public class EntityManagerImpl implements org.eclipse.persistence.jpa.JpaEntityM > * @param query > */ > public void addOpenQuery(QueryImpl query) { >- if (openQueries == null) { >- openQueries = new ArrayList<QueryImpl>(); >- } >- >- openQueries.add(query); >+ getOpenQueries().add(query); > > // If there is an open transaction, tag the query to it to be closed > // on commite or rollback. >@@ -1728,10 +1738,8 @@ public class EntityManagerImpl implements org.eclipse.persistence.jpa.JpaEntityM > * Close any open queries executed against this entity manager. > */ > protected void closeOpenQueries() { >- if (openQueries != null) { >- for (QueryImpl openQuery : openQueries) { >- openQuery.close(); >- } >+ for (QueryImpl openQuery : getOpenQueries()) { >+ openQuery.close(); > } > } > >diff --git a/jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/StoredProcedureQueryImpl.java b/jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/StoredProcedureQueryImpl.java >index c6a71f6..d1d59c1 100644 >--- a/jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/StoredProcedureQueryImpl.java >+++ b/jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/StoredProcedureQueryImpl.java >@@ -22,6 +22,8 @@ > * - 350487: JPA 2.1 Specification defined support for Stored Procedure Calls > * 08/24/2012-2.5 Guy Pelletier > * - 350487: JPA 2.1 Specification defined support for Stored Procedure Calls >+ * 09/12/2012-2.5 Guy Pelletier >+ * - 350487: JPA 2.1 Specification defined support for Stored Procedure Calls > ******************************************************************************/ > package org.eclipse.persistence.internal.jpa; > >@@ -233,15 +235,13 @@ public class StoredProcedureQueryImpl extends QueryImpl implements StoredProcedu > accessor.releaseStatement(executeStatement, query.getSQLString(), executeCall, session); > } > } catch (SQLException exception) { >- // With an external connection pool the connection may be null >- // after this call, if it is we will be unable to determine if >- // it is a connection based exception so treat it as if it wasn't. >+ // With an external connection pool the connection may be null after >+ // this call, if it is we will be unable to determine if it is a >+ // connection based exception so treat it as if it wasn't. > DatabaseException commException = accessor.processExceptionForCommError(session, exception, null); >- if (commException != null) { >- throw commException; >+ if (commException == null) { >+ throw DatabaseException.sqlException(exception, executeCall, accessor, session, false); > } >- >- throw DatabaseException.sqlException(exception, executeCall, accessor, session, false); > } > } > >@@ -370,6 +370,18 @@ public class StoredProcedureQueryImpl extends QueryImpl implements StoredProcedu > AbstractSession session = (AbstractSession) getActiveSession(); > DatabaseAccessor accessor = (DatabaseAccessor) executeCall.getQuery().getAccessor(); > ResultSet resultSet = executeStatement.getResultSet(); >+ >+ // If the result set is closed, move to the next one if there >+ // is one. If the result set is closed we have already processed >+ // that result. >+ if (resultSet.isClosed()) { >+ if (hasMoreResults()) { >+ resultSet = executeStatement.getResultSet(); >+ } else { >+ return null; >+ } >+ } >+ > executeCall.setFields(null); > executeCall.matchFieldOrder(resultSet, accessor, session); > ResultSetMetaData metaData = resultSet.getMetaData(); >@@ -382,14 +394,14 @@ public class StoredProcedureQueryImpl extends QueryImpl implements StoredProcedu > resultSet.close(); // This must be closed in case the statement is cached and not closed. > return ((ResultSetMappingQuery) executeCall.getQuery()).buildObjectsFromRecords(result, ++executeResultSetIndex); > } >- } catch (LockTimeoutException exception) { >- throw exception; >- } catch (RuntimeException exception) { >+ } catch (LockTimeoutException e) { >+ throw e; >+ } catch (RuntimeException e) { > setRollbackOnly(); >- throw exception; >+ throw e; > } catch (SQLException e) { > setRollbackOnly(); >- throw new RuntimeException(e); >+ throw new PersistenceException(e); > } > } > >@@ -422,7 +434,6 @@ public class StoredProcedureQueryImpl extends QueryImpl implements StoredProcedu > return -1; > } > >- > /** > * Returns true if the next result corresponds to a result set, > * and false if it is an update count or if there are no results >-- >1.7.11.msysgit.1 > Created attachment 221578 [details]
Progress patch (Sept 27)
Includes REF_CURSOR support for Oracle DB.
Last progress patch has been submitted. All reviewed by Gordon Yorke New model and tests added to the JPA 2.1 model and tests package. Created attachment 222133 [details]
Update patch (more tests and fixes)
Created attachment 222188 [details]
Update patch (more tests and fixes)
Created attachment 222246 [details]
More testing
Created attachment 222520 [details]
More testing (Oct 18th)
Created attachment 222522 [details]
More testing (Oct 18th)
Created attachment 222533 [details]
More testing (Oct 18th)
Created attachment 223188 [details]
Updates (Nov 5, 2012)
Updates after further review of the feature and new testing scenarios.
Created attachment 225990 [details]
XML tests and eclipselink orm schema updates.
EclipseLink orm schema updates made to align with orm_2_1.xsd.
Created attachment 227423 [details]
More testing and fixes (Feb 21, 2013)
Created attachment 227479 [details]
More testing and fixes (Feb 22, 2013)
Created attachment 227951 [details]
More testing and fixes (Mar 05, 2013)
Created attachment 227998 [details]
More testing and fixes (Mar 06, 2013)
Created attachment 228203 [details]
Small update to avoid errors with JTA usage.
Created attachment 228385 [details]
More testing and fix to handle positional cursor parameters correctly.
Created attachment 228435 [details]
More testing and fixes (Mar 14, 2013)
Created attachment 228739 [details]
Stored procedure support on PostGres
Submitted: Peter Krogh
Reviewed: Gordon Yorke, James Sutherland
Created attachment 229094 [details]
DataDirect driver support and another fix for PostgreSQL
Created attachment 229107 [details]
Amendment to previous patch
*** Bug 402379 has been marked as a duplicate of this bug. *** Created attachment 229128 [details]
Sybase Datadirect driver support
Created attachment 229208 [details]
Oracle DataDirect driver support.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |