Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds connection unwrapping abilities to CDISEPlatform.java #5790

Merged
merged 1 commit into from
Jan 6, 2023

Conversation

ljnelson
Copy link
Member

@ljnelson ljnelson commented Jan 6, 2023

Signed-off-by: Laird Nelson laird.nelson@oracle.com

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
@ljnelson ljnelson added jpa/jta 3.x Issues for 3.x version branch labels Jan 6, 2023
@ljnelson ljnelson self-assigned this Jan 6, 2023
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jan 6, 2023
@ljnelson
Copy link
Member Author

ljnelson commented Jan 6, 2023

This pull request augments the CDISEPlatform class to unwrap connections.

Eclipselink has a bunch of scaffolding to perform various unwrapping-type operations on connections to work around the Oracle driver's (buggy) blind casting of a Connection to an OracleConnection in certain date-and-time-related scenarios. The existing default behavior that Eclipselink implements is itself also flawed: it "unwraps" a Connection by calling connection.getMetaData().getConnection() and assumes that the Connection so returned will be different from the connection whose getMetaData() method was called. (This is actually ruled out by the JDBC contract: connection.getMetaData().getConnection() must return connection; the fact that apparently Eclipselink has encountered drivers for which this is not true indicates a bug in the driver in question, and so the fact that this "workaround" may work for any given driver is actually indicative of a JDBC contract violation in that driver.)

In Helidon 3.0.2 and earlier, we had a similar mistake where a call of connection.getMetaData().getConnection() invoked on a Helidon-proxied Connection would return the underlying, non-proxied Connection. This bug allowed the Oracle driver bug described above to stay hidden. Helidon 3.1.0 fixed this issue, but that uncovered the Oracle driver bug, which will now manifest itself in certain date-and-time situations when used with Eclipselink in Helidon 3.1.0.

To fix all this, this PR simply checks to see if the incoming Connection that should be "unwrapped" is a DelegatingConnection, and, if so, calls super.unwrapConnection(d) with its delegate d.

@ljnelson ljnelson merged commit b889d82 into helidon-io:helidon-3.x Jan 6, 2023
@ljnelson ljnelson deleted the unwrap-connection-3.x branch January 6, 2023 01:51
ljnelson added a commit to ljnelson/helidon that referenced this pull request Aug 23, 2023
…o#5790)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
ljnelson added a commit that referenced this pull request Aug 25, 2023
* Improves integrations/jdbc/jdbc to better support future JPA improvements; initial work (#5654)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Squashable commit; initial work (#5716)

Lays some groundwork with deprecation and cleanup and isolated improvements to support ongoing JPA improvements.

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Introduces LocalXAResource and a few support classes in jta/jdbc. (#5733)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Adds connection unwrapping abilities to CDISEPlatform.java (#5790)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Introduces JtaConnection.java (#5905)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Fixes erroneous closing behavior in JtaConnection.java (#6321)

* Fixes erroneous closing behavior in JtaConnection.java

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Minor JPA cleanups; part of overall refactoring effort (#6435)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Improving JPA pom.xml as part of overall JPA refactoring (#6508)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Fixes merge conflicts etc. from cherry-pick of c9a849e

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Adds an enabled flag to JpaExtension to permit subsequent refactoring and replacement (#6512)

Adds an enabled flag to JpaExtension to permit subsequent refactoring and replacement

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Adds more classes as part of overall JPA refactoring effort (#6584)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Lets unit tests validating JpaExtension and unit tests validating PersistenceExtension run side-by-side; continuation of overall fix for nested transaction problems (#7118)

* Lets unit tests validating JpaExtension and unit tests validating PersistenceExtension run side-by-side; continuation of overall fix for nested transaction problems

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Resolves issue 7316, which features some intermittent database-related tests (#7317)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Addresses copyright plugin complaints after lots of cherry-picking from old 3.x commits

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

---------

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
dalexandrov pushed a commit to dalexandrov/helidon that referenced this pull request Aug 26, 2023
* Improves integrations/jdbc/jdbc to better support future JPA improvements; initial work (helidon-io#5654)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Squashable commit; initial work (helidon-io#5716)

Lays some groundwork with deprecation and cleanup and isolated improvements to support ongoing JPA improvements.

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Introduces LocalXAResource and a few support classes in jta/jdbc. (helidon-io#5733)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Adds connection unwrapping abilities to CDISEPlatform.java (helidon-io#5790)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Introduces JtaConnection.java (helidon-io#5905)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Fixes erroneous closing behavior in JtaConnection.java (helidon-io#6321)

* Fixes erroneous closing behavior in JtaConnection.java

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Minor JPA cleanups; part of overall refactoring effort (helidon-io#6435)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Improving JPA pom.xml as part of overall JPA refactoring (helidon-io#6508)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Fixes merge conflicts etc. from cherry-pick of c9a849e

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Adds an enabled flag to JpaExtension to permit subsequent refactoring and replacement (helidon-io#6512)

Adds an enabled flag to JpaExtension to permit subsequent refactoring and replacement

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Adds more classes as part of overall JPA refactoring effort (helidon-io#6584)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Lets unit tests validating JpaExtension and unit tests validating PersistenceExtension run side-by-side; continuation of overall fix for nested transaction problems (helidon-io#7118)

* Lets unit tests validating JpaExtension and unit tests validating PersistenceExtension run side-by-side; continuation of overall fix for nested transaction problems

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Resolves issue 7316, which features some intermittent database-related tests (helidon-io#7317)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

* Addresses copyright plugin complaints after lots of cherry-picking from old 3.x commits

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>

---------

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Issues for 3.x version branch jpa/jta OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants