JDBC not mapping properly in 4.5.0
See original GitHub issueCurl request on the database:
/usr/bin/curl -on/json' -sSXPOST '127.0.0.1:4200/_sql?pretty' -d@- << EOF
{"stmt":"SELECT allowed_users FROM myproject.projects WHERE allowed_users != [NULL]"}
EOF
Result:
{"cols":["allowed_users"],"rows":[[[{"accepted":false,"role":"developer","email":"email@gmail.com"}]]],
"rowcount":1,"duration":50.122208}
Java line on which error occurs:
Object[] array = (Object[]) rs.getArray("allowed_users").getArray();
Java model AllowedUser:
public class AllowedUser {
@JsonProperty
String email;
@JsonProperty
String role;
@JsonProperty
Boolean accepted;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public Boolean getAccepted() {
return accepted;
}
public void setAccepted(Boolean accepted) {
this.accepted = accepted;
}
}
Error that Crate returns:
Unrecognized field "type" (class models.AllowedUser), not marked as ignorable
(3 known properties: "email", "role", "accepted"]) at [Source: (String)"[{"type":"json","value":
"{\"accepted\":false,\"email\":\"email@gmail.com\",\"role\":\"developer\"}"}]"; line: 1, column: 11]
(through reference chain: java.util.ArrayList[0]->models.AllowedUser["type"])
Column allowed_users defined as:
allowed_users ARRAY(OBJECT(IGNORED))
Locally and on the QA server Crate doesn’t return any errors and works as expected. The issue occurs only on the production server. The dataset is identical on all envs.
Local and QA Crate version: 4.0.10 Production Crate version: 4.5.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
No Dialect mapping for JDBC type: 1111 - java - Stack Overflow
The error message means one column returns data in a type which cannot be mapped. No Dialect mapping for JDBC type: 1111 indicates...
Read more >“How-to” Guides - Spring
A YAML file is parsed to a Java Map<String,Object> (like a JSON object), and Spring Boot flattens the map so that it is...
Read more >Micronaut Data - GitHub Pages
Rewritten entity mapper allows more complex mapping for JDBC/R2DBC entities ... Since Micronaut Data is a build time tool, it will not work...
Read more >Defects fixed in the IDM 4.5.0 release - Support - Micro Focus
Defect ID Component Description
848056 Audit Integration Audit events are not generated for .NET RL
894551 Audit Integration Latest IDM Collector not rebraned to NetIQ
867897...
Read more >Use Spring Data JDBC with Azure Database for PostgreSQL
Learn how to use Spring Data JDBC with an Azure Database for PostgreSQL ... Cloud Azure currently supports passwordless connections only in version...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@proddata thank you so much for your patience and your assistance Georg. I’ve managed to solve the issue and If anyone comes across the same issue, you need to loop your data and parse the Object from the (Object[] array) to a method similar to this:
Something like that:
I will close this issue now, as this is neither a bug report, nor feature request for CrateDB. I would kindly as you to open a new discussion on https://community.crate.io/ for that matter