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

Fix calling stored procs on Postgres, and enable some tests #2308

Merged
merged 2 commits into from
Dec 20, 2024

Conversation

rdicroce
Copy link
Contributor

Fixes calling stored procedures on Postgres. Without this change, EclipseLink does SELECT * FROM name_of_proc which causes an exception. This change also removes the isJDBCExecuteCompliant() method, which is not needed anymore as far as I can tell, and enables a few stored procedure tests for Postgres to prevent regressions.

This PR targets the 4.0 branch but would also need to be done for 5.0.

Copy link
Contributor

@rfelcman rfelcman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general please update copyright year in the file headers.

@@ -201,7 +205,7 @@ private static boolean createSimpleStoredProcedure(EntityManagerFactory emf) {
//Add more platform specific diction to support more platforms
if(platform.isMySQL()) {
proc.addStatement("SET out_param_one = CONCAT('One: ',in_param_one,' Two: ',in_param_two,' Three: ',in_param_three)");
} else if(platform.isOracle()) {
} else if(platform.isOracle() || platform.isPostgreSQL()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It throws

[ERROR]   TestStoredProcedures.setup:54->createSimpleStoredProcedure:222 » Database 
Internal Exception: org.postgresql.util.PSQLException: ERROR: procedures cannot have OUT arguments
  Hint: INOUT arguments are permitted.
Error Code: 0
Call: CREATE PROCEDURE simple_order_procedure (
	in_param_one VARCHAR(10),
	in_param_two VARCHAR(10),
	in_param_three VARCHAR(10),
	 OUT out_param_one VARCHAR(30)) AS
.....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently PG only supports OUT params since version 14. I have 17 installed, so it worked for me. I've modified the test to use INOUT instead for PG. It works on 17, and hopefully it works on whatever version you're testing with.

@rdicroce
Copy link
Contributor Author

In general please update copyright year in the file headers.

Copyright year has been updated for the files I changed.

Copy link
Contributor

@rfelcman rfelcman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rfelcman rfelcman merged commit 452ffdd into eclipse-ee4j:4.0 Dec 20, 2024
3 checks passed
@rfelcman
Copy link
Contributor

Second release candidate, with this PR, of EclipseLink 4.0.5 (4.0.5-RC2) is available.
You can download it from usual sources like:
Maven Central
Milestone builds: https://download.eclipse.org/rt/eclipselink/milestones/4.0.5/RC2/
List of changes against 4.0.5-RC1 is available at: https://github.com/eclipse-ee4j/eclipselink/releases/tag/4.0.5-RC2

@rdicroce
Copy link
Contributor Author

Thanks. Do you want me to make another PR for master branch? Or are you going to port it yourself?

@rfelcman
Copy link
Contributor

Please make port to master.
Thank You

@rdicroce
Copy link
Contributor Author

Will do. Do you want me to get rid of the isJDBCExecuteCompliant() method at the same time? Or just do a direct cherry-pick?

@rfelcman
Copy link
Contributor

In master branch 5.0 it should be removed isJDBCExecuteCompliant(). There is possible do some EclipseLink API changes as this next major version is not released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants