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

enum support #292

Open
rajatpandit opened this issue Apr 1, 2015 · 3 comments
Open

enum support #292

rajatpandit opened this issue Apr 1, 2015 · 3 comments

Comments

@rajatpandit
Copy link

In version 1.3; when trying to use enum, i get the error message, enum is not supported by SQL lite; is there a working example of how the model classes should look like?

@DavidSanf0rd
Copy link

public class User extends SugarRecord {
private String name;
private String password;
private UserType userType;

public User(){
}

public User(String name, String password, UserType userType){
    this.name = name;
    this.password = password;
    this.userType = userType;
}

public enum UserType{

    ADMIN(0), NORMAL_USER(1);

    private int type;

    private UserType(int type){
        this.type = type;
    }
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public String getPassword() {
    return password;
}

public void setPassword(String password) {
    this.password = password;
}

public UserType getUserType() {
    return userType;
}

public void setUserType(UserType userType) {
    this.userType = userType;
}

}

whoshuu pushed a commit that referenced this issue Apr 11, 2015
References #304
References #300
References #292
whoshuu pushed a commit that referenced this issue Apr 11, 2015
@whoshuu
Copy link
Collaborator

whoshuu commented Apr 12, 2015

@rajatpandit, let me know if updating to the latest Sugar library fixes your problem or not, or if you need more examples demonstrating Enum persistence.

@sibelius sibelius added this to the 2.0.0 milestone Nov 25, 2015
@JakeSteam
Copy link

@DavidSanf0rd 's solution resolves the OP being unable to save enums, vote to close?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants