Generate correct Informix SQL when parsing Concat Operator #1466
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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