Hello there !
Here is my problem:
I have a couchDB database running, and I am trying to get one of its documents' property from Ektorp API, but I am unable to.
To make it short, my field is named "Project" and is represented as something like:
--------------------------------------------------------------------------------------------------
Field "Project" from document in CouchDB database:
{
"name": ...,
"ver": ...,
"type": ...,
"Properties": {
[bunch of String properties]
},
"modules": {
"modulename": {
[bunch of String properties],
[some other imbricated objects]
}
}
}
--------------------------------------------------------------------------------------------------
As the Project field is injected via a POST method directly in a single field as a single String, I thought I could retrieve it directly, but I have the following response:
Template.java:
--------------------------------------------------------------------------------------------------
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonIgnoreProperties(ignoreUnknown = true)
public class TemplateType {
@JsonProperty("_id")
private String id;
@JsonProperty("_rev")
private String revision;
private String Project;
public TemplateV2Type() {
}
[getters and setters]
--------------------------------------------------------------------------------------------------
MainClass:
--------------------------------------------------------------------------------------------------
[http connections and configs]
[TemplateRepository instance].get(<existing document ID>);
System.out.println(templ.getProject());
--------------------------------------------------------------------------------------------------
Response from Ektorp:
--------------------------------------------------------------------------------------------------
2868 [main] DEBUG org.apache.http.headers - << HTTP/1.1 200 OK
null
--------------------------------------------------------------------------------------------------
I checked, the document exists, the GET is correctly sent, but it seems that Java cannot retrieve the Project field correctly ...
If I remove the @JsonIgnoreProperties(ignoreUnknown = true) or if I do not ignore the Project property, I'm getting the following error:
Exception in thread "main" org.ektorp.DbAccessException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "Project"
I'd be thankful if you could help me, I only have a few days on Ektorp and I cannot find out why I cannot get this field.
Is this because the field, even if injected as a String, is a JSON Object and must be retrieved as if ?
Is there a way to get a JSON Object from an field in a document using Ektorp ?
Thank you,
Yassine Badache