requery: Error deserializing Entity classes with Gson

I’m getting an error when I desieralize JSON into my entity classes using Gson. My app fails with a JNI error that says

JNI DETECTED ERROR IN APPLICATION: can't make objects of type com.-redacted-.model.requery.RequeryUser: 0x12e84980

I have a top level RequeryFeedItem that is composed of a RequeryUser (I am required to use interfaces because I am binding them to layouts using Android Databinding.). The API returns List<RequeryFeedItem>, so that is what I am trying to deserialize.

@Entity("FeedItemEntity")
public interface RequeryFeedItem {
    @ForeignKey
    @ManyToOne(cascade = {CascadeAction.DELETE, CascadeAction.SAVE})
    RequeryUser getOwner();
}
@Entity(name = "UserEntity")
public interface RequeryUser {
    @Key
    String getId();
}

@KrzysztofWrobel @npurushe Do either of you have any tips for fixing this issue when integrating Requery with Gson?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 21 (8 by maintainers)

Most upvoted comments

Can we get an explicit example of how to do this, or a better resource on how to do this. This is a huge deal for how I intend on using the library.