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.

I wants to save a key value pairs in the DB but Realm stops the compiling of the project when getting object like so

See original GitHub issue

Goal saving keyVlaue pair in the DB

Expected Results keyValue pairs saved in the DB

Actual Results the project stops compile as of Realm doesn’t generate proxy classes

Code Sample

public class KeyValue <T extends RealmObject> extends RealmObject{
    @PrimaryKey
    private String key;
    private T object;

    public RealmKeyValue() {
    }

    public void setKeyValue(String key, T object) {
        this.key = key;
        this.object = object;
    }
}

Version of Realm and tooling 3.1.4

Realm sync feature enabled: no

Android Studio version: 2.3.2

Which Android version and device: 6

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
Zhuindencommented, May 13, 2017

The problem is that each generic type of this class would be a new table, and I don’t think that can be detected.

It would work if generics worked like they do in C++ but it doesn’t.

1reaction
bmeikecommented, May 13, 2017

It isn’t like we don’t support that because we are grumps, I just isn’t clear what it would mean, when storing stuff in the DB. 😉 So, I have to ask:. When you say “I want to do something like that”, what do you mean, exactly? What are you trying to accomplish? Happy to help, with a little more info…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using dictionaries to store data as key-value pairs
The dictionary stores objects as key-value pairs and can be used to represent complex real-world data.
Read more >
Realm: Create reactive mobile apps in a fraction of the time
Realm is installed as a Gradle plugin. Step 1: Add the class path dependency to the project level build.gradle file. Copy to clipboard...
Read more >
GitLab Container Registry administration
With the GitLab Container Registry, every project can have its own space to store Docker images. Read more about the Docker Registry in...
Read more >
TACACS+
A program which services network requests for authentication and authorization, verifies identities, grants or denies authorizations, and logs accounting ...
Read more >
Why the Hell Would I Use Node.js? A Case-by-case Tutorial
Server-side Web Application With a Relational Database Application. Ruby on Rails was once the clear choice as a tool to access relational databases...
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