question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Can't access the newly created document when not using POJO

See original GitHub issue

Describe the bug Please note: we’re not using POJO. We’re working with raw JSON documents.

CosmosAsyncItemResponse<Document> dbResponse = container.createItem(new Document(documentAsJson)).block();

The responseBodyString property from the CosmosAsyncItemResponse contains the new document returned from the database, but it’s not accessible.

call to dbResponse.getResource() fails with an exception.

Exception or Stack Trace

com.fasterxml.jackson.databind.JsonMappingException: Conflicting setter definitions for property "defaultPropertyInclusion": com.fasterxml.jackson.databind.ObjectMapper#setDefaultPropertyInclusion(1 params) vs com.fasterxml.jackson.databind.ObjectMapper#setDefaultPropertyInclusion(1 params)
 at [Source: (String)"{"id":"myid_2020-03-25T09:49:38.586298500","level1":{"level2":"replace_with_your_partition_key"},"_rid":"eqt-AIauc2cPAAAAAAAAAA==","_self":"dbs\/eqt-AA==\/colls\/eqt-AIauc2c=\/docs\/eqt-AIauc2cPAAAAAAAAAA==\/","_etag":"\"bf02d59a-0000-0d00-0000-5e7b1b220000\"","_attachments":"attachments\/","_ts":1585126178}"; line: 1, column: 1]

Expected behavior We’d like to be able to access the JSON returned from the server. Either by calling the getResource() method and then converting to JSON or by a new getter for the JSON string.

Setup (please complete the following information):

  • OS: Windows
  • Cosmos DB Java SDK v4 preview.2

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
nmiodicecommented, Apr 5, 2020

For what its worth, this is also an issue when trying to read data classes using Kotlin.

return cosmosContainer
    .readItem(id, PartitionKey(id), clazz) // clazz refers to a data class object, i.e., MyDataClass::class.java
    .resource

which fails to deserialize because the object mapper cannot be configured to use the kotlin module.

Making the handler configurable or returning the raw response would help a ton for kotlin projects.

0reactions
kushagraThaparcommented, Apr 29, 2021

@mbhaskar - can you please provide update on this ? If this is a feature request, can you please tag the issue appropriately with feature-request tag ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue with new POJO Object - java - Stack Overflow
First, dataPOJO should not be extending Phone_Save . There's nothing dataPOJO needs to do that depends on it being an Activity (at least ......
Read more >
Error when trying to insert POJO document: Could not resolve ...
I'm trying to insert one POJO document into a collection in Android Studio and the returned error object says “failed to insert documents...
Read more >
Problem accessing POJO in birt Scripts - Eclipse
an already existing object and am unable to simply create a new one. Following the hints outlined in the Report Engine API document,...
Read more >
POJO Data Binding Interface (Java Application Developer's ...
Annotations can be associated with a member, a getter or a setter because an annotation decorates a logical property of your POJO class....
Read more >
230834 – Unable to rebuild Hibernate POJO's
Used bundled derby sample database Create hibernate reverse engineering xml ... table Invoke Hibernate Mappring wizard to create POJO file.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found