Skip to content
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

the data store in local is not always the same with data from server #963

Closed
machinezhou opened this issue Mar 15, 2015 · 2 comments
Closed
Labels

Comments

@machinezhou
Copy link

hi ,
please help me.
In my recent projects the data store in local database is not always the same with data from server.

My basemodel.class looks like this:

public class BaseModel{
private static final String SUCCESS_CODE = "00";
private static final String INVALID_COOKIE = "10";
public static final String JSON_ROOT_NAME = "data";

@SerializedName("statusCode")
public String statusCode;
@SerializedName("statusMsg")
public String statusMsg;
}

then my listmodel.class looks like this:

public abstract class ListModel extends BaseModel {
@SerializedName(JSON_ROOT_NAME)
public ArrayList modelList;
}

with retrofit and gson it works fine, but if I want to store the modelList into database without status info, how can I do? For now I can get the List , but realm requires "extends RealmObject", any idea?

@cmelchior
Copy link
Contributor

Hi @machinezhou
Currently Realm doesn't support subclassing (except from RealmObject), so your only choice is to move the fields from BaseMode to your ListModel.

However it is definitely something we want to support going forward, but there are a few hurdles in the core database we have to tackle first. You can follow progress on this here: #761

@machinezhou
Copy link
Author

ok then, looking forward. Thanks for your effort.
2015年3月16日 上午4:41于 "Christian Melchior" [email protected]写道:

Hi @machinezhou https://github.com/machinezhou
Currently Realm doesn't support subclassing (except from RealmObject), so
your only choice is to move the fields from BaseMode to your ListModel.

However it is definitely something we want to support going forward, but
there are a few hurdles in the core database we have to tackle first. You
can follow progress on this here: #761
#761


Reply to this email directly or view it on GitHub
#963 (comment).

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants