New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RealmList<Integer / String / ...> #575

Closed
an-k opened this Issue Nov 18, 2014 · 139 comments

Comments

Projects
None yet
@an-k

an-k commented Nov 18, 2014

Dear realm-Team,

I'm really impressed by Realm and I do like the way you're providing support and solutions on github, SO and gGroups! I like working with Realm - however there are three really big drawbacks for me:

  1. No model-instantiation by = new ... - I know you're on it. I can't wait for this! Do we have to wait for the "whole" JSON-Upgrade or will there be an earlier release providing this feature?

  2. No model-passing across threads. That's hindering all the great benefits of EventBus and Android Priority Job Queue. But I read that it will be possible in the further versions and I'm looking forward on this.

  3. The reason for this issue:
    In my model class I'm allowed to have primitive fields as well as object fields of objects that extend RealmObject.
    But I'm not allowed to have a field type like RealmList<Integer> or RealmList<String>.
    However it is possible to work around this by

RealmList<RealmString> names;

and

public class RealmString extends RealmObject {
private String name;
// getter & setter

It works but it's really ugly and should be unnecessary in my opinion.
Is there any improvement planned regarding this?

Thanks again for your great work - I'm glad Realm helps me developing my app!


Related PRs:

@an-k an-k changed the title from RealmList<Primitive> to RealmList<Integer / String / ...> Nov 18, 2014

@codezion

This comment has been minimized.

Show comment
Hide comment
@codezion

codezion Nov 18, 2014

I had bit of worries about the Realm design but after using it a lot i have seen it is done just right. My primary use of Realm is to pass data between threads (background processing and UI) and it works perfectly. It is so fast that even AsyncTasks are not needed anymore. Great work. Just few bugs left but easy to work around while waiting for the completion. I hope the next release comes out soon.

codezion commented Nov 18, 2014

I had bit of worries about the Realm design but after using it a lot i have seen it is done just right. My primary use of Realm is to pass data between threads (background processing and UI) and it works perfectly. It is so fast that even AsyncTasks are not needed anymore. Great work. Just few bugs left but easy to work around while waiting for the completion. I hope the next release comes out soon.

@kneth kneth added the T:Enhancement label Nov 18, 2014

@kneth

This comment has been minimized.

Show comment
Hide comment
@kneth

kneth Nov 18, 2014

Contributor

@an-k I think that your suggestion (RealmList<String> etc.) is a good one. The complexity of implementing it is "less than impossible" but "greater than trivial". In particular the querying these lists of primitive types could be a bit tricky.

To make a long story short, I can give you a time frame in which it will be implemented.

Contributor

kneth commented Nov 18, 2014

@an-k I think that your suggestion (RealmList<String> etc.) is a good one. The complexity of implementing it is "less than impossible" but "greater than trivial". In particular the querying these lists of primitive types could be a bit tricky.

To make a long story short, I can give you a time frame in which it will be implemented.

@an-k

This comment has been minimized.

Show comment
Hide comment
@an-k

an-k Nov 18, 2014

@kneth Thanks for your reply! You can give a time frame? That's great, so when will that probably be?

an-k commented Nov 18, 2014

@kneth Thanks for your reply! You can give a time frame? That's great, so when will that probably be?

@kneth

This comment has been minimized.

Show comment
Hide comment
@kneth

kneth Nov 19, 2014

Contributor

@an-k Sorry for being unclear (I forgot a "not"); we don't have any time frame as we haven't decided if we wish to support it.

Contributor

kneth commented Nov 19, 2014

@an-k Sorry for being unclear (I forgot a "not"); we don't have any time frame as we haven't decided if we wish to support it.

@Hazer

This comment has been minimized.

Show comment
Hide comment
@Hazer

Hazer Dec 23, 2014

@kneth This issue is the major reason for not using it in production yet, I can't change my JSON input, so to use it, I would have to do some really ugly tricks.
And with issues #489 and now #682 rising, I think it should be considered worth supporting.

For my use cases, if it got serialized as a string in the database and back as List, without any type of in db querying (no need to limit, search, just retrieve all), would be perfect.

I think that should be added some kind of RealmPrimitive class or an @ElementCollection annotation like the JPA 2 has.

Hazer commented Dec 23, 2014

@kneth This issue is the major reason for not using it in production yet, I can't change my JSON input, so to use it, I would have to do some really ugly tricks.
And with issues #489 and now #682 rising, I think it should be considered worth supporting.

For my use cases, if it got serialized as a string in the database and back as List, without any type of in db querying (no need to limit, search, just retrieve all), would be perfect.

I think that should be added some kind of RealmPrimitive class or an @ElementCollection annotation like the JPA 2 has.

@jenzz

This comment has been minimized.

Show comment
Hide comment
@jenzz

jenzz Feb 7, 2015

Can I ask what the current state and/or priority of this feature request is?
Or: What is the recommended workaround for now?

jenzz commented Feb 7, 2015

Can I ask what the current state and/or priority of this feature request is?
Or: What is the recommended workaround for now?

@mpost

This comment has been minimized.

Show comment
Hide comment
@mpost

mpost Feb 8, 2015

I agree that this is a worthwhile feature. +1.

mpost commented Feb 8, 2015

I agree that this is a worthwhile feature. +1.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Feb 11, 2015

Yes, please

ghost commented Feb 11, 2015

Yes, please

@kboyarshinov

This comment has been minimized.

Show comment
Hide comment
@kboyarshinov

kboyarshinov Feb 12, 2015

Contributor

+1

Contributor

kboyarshinov commented Feb 12, 2015

+1

@FHellmann

This comment has been minimized.

Show comment
Hide comment
@FHellmann

FHellmann Mar 7, 2015

+1

Not only primitive datatypes should be mentioned. Enums should be set in a list too.

FHellmann commented Mar 7, 2015

+1

Not only primitive datatypes should be mentioned. Enums should be set in a list too.

@theyann

This comment has been minimized.

Show comment
Hide comment
@theyann

theyann Mar 18, 2015

+1 for the List of primitive and also +1 for the Enums.
I'm actually kinda stuck now as I have a JSON with a list of strings that needs to go to the DB, not quite sure yet how to deal with that.

theyann commented Mar 18, 2015

+1 for the List of primitive and also +1 for the Enums.
I'm actually kinda stuck now as I have a JSON with a list of strings that needs to go to the DB, not quite sure yet how to deal with that.

@RobertoArtiles

This comment has been minimized.

Show comment
Hide comment

RobertoArtiles commented Mar 30, 2015

+1

@kbpontius

This comment has been minimized.

Show comment
Hide comment
@kbpontius

kbpontius commented Apr 17, 2015

+1

@jmachete

This comment has been minimized.

Show comment
Hide comment
@jmachete

jmachete commented Apr 24, 2015

+1

@bmunkholm bmunkholm added P2 and removed P1 labels Apr 27, 2015

@marianmoldovan

This comment has been minimized.

Show comment
Hide comment

marianmoldovan commented Apr 27, 2015

+1

@theostanton

This comment has been minimized.

Show comment
Hide comment

theostanton commented Apr 30, 2015

+1

@eygraber

This comment has been minimized.

Show comment
Hide comment
@eygraber

eygraber commented May 1, 2015

+1

@harish1312

This comment has been minimized.

Show comment
Hide comment
@harish1312

harish1312 May 12, 2015

A list of Strings is a very common use case for JSON responses. When you are given an array of Strings such as

"phoneNumbers":["000-000-0000", "111-111-1111"]

and you need to store it in the database, you need a list of Strings.

Implementing a workaround for every instance of a JSONArray of Strings would be bloated and ugly, unless I'm not understanding the workaround correctly. Can I create a RealmString once and use it in place of String everywhere that I would need a RealmList of Strings? How would I get RetroFit (REST library from Square) to play nice with such an implementation?

In any case, having this issue resolved would simplify the code and it seems that many people are looking for the same feature. Perhaps the priority of this feature should be increased over something else.

harish1312 commented May 12, 2015

A list of Strings is a very common use case for JSON responses. When you are given an array of Strings such as

"phoneNumbers":["000-000-0000", "111-111-1111"]

and you need to store it in the database, you need a list of Strings.

Implementing a workaround for every instance of a JSONArray of Strings would be bloated and ugly, unless I'm not understanding the workaround correctly. Can I create a RealmString once and use it in place of String everywhere that I would need a RealmList of Strings? How would I get RetroFit (REST library from Square) to play nice with such an implementation?

In any case, having this issue resolved would simplify the code and it seems that many people are looking for the same feature. Perhaps the priority of this feature should be increased over something else.

@kneth

This comment has been minimized.

Show comment
Hide comment
@kneth

kneth May 13, 2015

Contributor

@harish1312 In the documentation (http://realm.io/docs/java/latest/#other-libraries) you can read on how to use Realm with RetroFit and GSON.

Contributor

kneth commented May 13, 2015

@harish1312 In the documentation (http://realm.io/docs/java/latest/#other-libraries) you can read on how to use Realm with RetroFit and GSON.

@thecodingwizard

This comment has been minimized.

Show comment
Hide comment

thecodingwizard commented Jun 3, 2015

+1

@yoavst

This comment has been minimized.

Show comment
Hide comment
@yoavst

yoavst commented Jun 12, 2015

+1

@bmunkholm bmunkholm added T:Feature and removed T:Enhancement labels Jun 13, 2015

@LouisCAD

This comment has been minimized.

Show comment
Hide comment
@LouisCAD

LouisCAD commented Jun 25, 2015

+1

@dulakm

This comment has been minimized.

Show comment
Hide comment
@dulakm

dulakm commented Jul 11, 2015

+1

@azizj1

This comment has been minimized.

Show comment
Hide comment
@azizj1

azizj1 commented Jul 23, 2015

+1

@s4x

This comment has been minimized.

Show comment
Hide comment
@s4x

s4x commented May 6, 2016

+1

@paulimfavarato

This comment has been minimized.

Show comment
Hide comment

paulimfavarato commented May 9, 2016

+1

@hari2109

This comment has been minimized.

Show comment
Hide comment
@hari2109

hari2109 commented May 10, 2016

+1

@nimitsolanki

This comment has been minimized.

Show comment
Hide comment

nimitsolanki commented May 10, 2016

+1

@dawidhyzy

This comment has been minimized.

Show comment
Hide comment
@dawidhyzy

dawidhyzy commented May 10, 2016

+1

@ItsCalebJones

This comment has been minimized.

Show comment
Hide comment

ItsCalebJones commented May 13, 2016

+1

@iguerendiain

This comment has been minimized.

Show comment
Hide comment

iguerendiain commented May 13, 2016

+1

@jpmcglone

This comment has been minimized.

Show comment
Hide comment
@jpmcglone

jpmcglone commented May 15, 2016

+1

@angcyo

This comment has been minimized.

Show comment
Hide comment
@angcyo

angcyo commented May 16, 2016

+1

@sergiomarquesmoura

This comment has been minimized.

Show comment
Hide comment

sergiomarquesmoura commented May 17, 2016

+1

@andriipanasiuk

This comment has been minimized.

Show comment
Hide comment

andriipanasiuk commented May 19, 2016

+1

@giaotuancse

This comment has been minimized.

Show comment
Hide comment

giaotuancse commented May 23, 2016

+1

@cmelchior cmelchior added S:P1 Backlog and removed S:P2 Backlog labels May 25, 2016

@b-raines

This comment has been minimized.

Show comment
Hide comment
@b-raines

b-raines May 25, 2016

How is this still not supported?!?

b-raines commented May 25, 2016

How is this still not supported?!?

@hasanabuzayed

This comment has been minimized.

Show comment
Hide comment

hasanabuzayed commented Jun 2, 2016

+1

@henriquedesousa

This comment has been minimized.

Show comment
Hide comment

henriquedesousa commented Jun 2, 2016

+1

@MGaetan89

This comment has been minimized.

Show comment
Hide comment
@MGaetan89

MGaetan89 Jun 2, 2016

Can someone from the team lock this conversation until there is some news? For the moment it's just spamming everyone watching.
If someone else want to follow it, there is a "Subscribe" button on the right...

MGaetan89 commented Jun 2, 2016

Can someone from the team lock this conversation until there is some news? For the moment it's just spamming everyone watching.
If someone else want to follow it, there is a "Subscribe" button on the right...

@bmunkholm

This comment has been minimized.

Show comment
Hide comment
@bmunkholm

bmunkholm Jun 3, 2016

Contributor

Everyone should really get used to using the nice new smileys in the top description field of the issue :-) But we will Lock this for now.
This feature is among a handfull of top features that we hope to take on next. We will however give the current 1.0 a bit of peace to ensure stability before we push a lot of new features.

Contributor

bmunkholm commented Jun 3, 2016

Everyone should really get used to using the nice new smileys in the top description field of the issue :-) But we will Lock this for now.
This feature is among a handfull of top features that we hope to take on next. We will however give the current 1.0 a bit of peace to ensure stability before we push a lot of new features.

@realm realm locked and limited conversation to collaborators Jun 3, 2016

@realm realm unlocked this conversation Oct 4, 2016

@realm realm locked and limited conversation to collaborators Oct 4, 2016

@cmelchior

This comment has been minimized.

Show comment
Hide comment
@cmelchior

cmelchior Jan 17, 2017

Contributor

Work in Realm Core can be tracked here: realm/realm-core#1881

Contributor

cmelchior commented Jan 17, 2017

Work in Realm Core can be tracked here: realm/realm-core#1881

@cmelchior cmelchior added this to the 3.3 milestone Apr 7, 2017

@cmelchior cmelchior modified the milestones: 3.4, 3.3 Apr 25, 2017

@bmunkholm bmunkholm added S:Backlog and removed S:P2 Backlog labels May 18, 2017

@cmelchior cmelchior modified the milestones: 4.0, 3.5 Jun 23, 2017

@cmelchior cmelchior closed this in #5031 Oct 1, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.