Using Sugar ORM with UUID or Joda-Time

I am creating a mobile application that will have users as defined below:

public class UserObject extends SugarRecord<UserObject>
{
    public UUID Id;
    public String Name;
    public int DefaultSort;
    public String Username;
    public Date LastLogin;

    public UserObject()
    {

    }

    public UserObject(UUID id, String name, int defaultSort, String username, String password, Date lastLogin)
    {
        this.Id = id;
        this.Name = name;
        this.DefaultSort = defaultSort;
        this.Username = username;
        this.LastLogin = lastLogin;
    }
}

These users will be extracted from the API - identifiers are stored in the database as uniqueidentifiers (or GUIDs in C #).

When I enter a new entry in the users table, everything works fine:

    DateTime dt = new DateTime();
    UUID newUID = UUID.randomUUID();
    UserObject newUser = new UserObject(newUID, "David", 1, "userOne", "password", dt.toDate());
    newUser.save();

However, when I try to get the return value, I get the error message:

The class cannot be read from the Sqlite3 database. Please check Id field type (java.util.UUID)

Is Sugar ORM (or SQLite) just not support UUID? If I try using Joda DateTime, replacing "LastLogin", the table just won’t create at all, so it looks like it can create fields, it just doesn’t retrieve / not save them ...

+4
2

var Id. Sugar Id. - Id

public class UserObject extends SugarRecord{
    public UUID uId;
    public String Name;
    public int DefaultSort;
    public String Username;
    public Date LastLogin;

    public UserObject()
    {

    }

    public UserObject(UUID uId, String name, int defaultSort, String username, String password, Date lastLogin)
    {
        this.uId= uId;
        this.Name = name;
        this.DefaultSort = defaultSort;
        this.Username = username;
        this.LastLogin = lastLogin;
    }
}

v1.4 SugarRecord

0

Sugar ORM . , , , ( , JODA).

, . , , , , , SQLite .

0

All Articles