Skip to content

BadSqlGrammarException is caused when using JSON-P JsonObject in Entity Class #1157

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

Closed
TheStrixCoder opened this issue Feb 4, 2022 · 1 comment
Labels
status: duplicate A duplicate of another issue

Comments

@TheStrixCoder
Copy link

My Entity Class is as follows:

@table(value = "VEHICLE_JSON")
public class VehicleJSON {
@id
private Long id;
@column("JSON_DATA_VEHICLE")
private javax.json.JsonObject jsonObject;
}

I am getting the exception:
org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT "JSON_VALUE"."VALUE_TYPE" AS "VALUE_TYPE", "JSON_VALUE"."VEHICLE_JSON_KEY" AS "VEHICLE_JSON_KEY" FROM "JSON_VALUE" WHERE "JSON_VALUE"."JSON_DATA_VEHICLE" = ?]; nested exception is java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

It works fine when using a POJO class to map the Database JSON column, but fails when using a generic JsonObject like JSON-P. It's considering JsonObject as a table.

I am using Oracle 21c database. I have attached the full stack trace for reference
stack.txt

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 4, 2022
@schauder
Copy link
Contributor

schauder commented Feb 4, 2022

There is no JSON support yet. See #509.
Spring Data JDBC considers JsonObject just another entity, and tries to map it and its properties to a table and columns.

@schauder schauder closed this as completed Feb 4, 2022
@schauder schauder added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants