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

Generate correct Informix SQL when parsing Concat Operator #1466

Merged
merged 1 commit into from Aug 30, 2022

Conversation

jGauravGupta
Copy link
Member

Signed-off-by: Gaurav Gupta gaurav.gupta@payara.fish

EclipseLink generates SQL, that can't be parsed by the database. The problem is located in the handling of the Concat operator (JPQL and the criteria api are both affected).

Informix expectes the concat operation to be: <op1> || <op2>

Eclipselink generates: <op1> + <op2>

This is rejected by the DB server. The concat operator can be overridden for the db platform and if done so, the correct SQL is generated.
The test program is attached to demonstrate this issue. The program (de.persona.dev.blaesing.eclipselink.jpa.generation.test.Test) generates tables for a Demo Entity and then queries the concatenation of lastname and firstname.

Lines 17-18 instantiate the entitymanager
Lines 20-21 demonstrate a fix (if commented out, the error exists, with this fix the query works)
Lines 23-31 insert demo data
Lines 35-43 reproduce the problem with the criteria api
Lines 46-49 reproduce the problem with JPQL

The current result with line 20-21 commented throws an exception:

Caused by: java.sql.SQLException: A character to numeric conversion process failed

test-app.zip

Copy link
Member

@lukasj lukasj left a comment

Choose a reason for hiding this comment

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

ECA check failed

Signed-off-by: Gaurav Gupta <gaurav.gupta@payara.fish>
Copy link
Member

@lukasj lukasj left a comment

Choose a reason for hiding this comment

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

LGTM

@lukasj lukasj merged commit cc6bdf5 into eclipse-ee4j:master Aug 30, 2022
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.

None yet

2 participants