Skip to content

Instantly share code, notes, and snippets.

@horaceheaven
Created August 17, 2014 00:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save horaceheaven/c85a9414dc787aa5c337 to your computer and use it in GitHub Desktop.
Save horaceheaven/c85a9414dc787aa5c337 to your computer and use it in GitHub Desktop.
Creating a sample Todo database model
@DatabaseTable(tableName = "todo")
public class Todo {
@DatabaseField(generatedId = true)
private Long id;
@DatabaseField
private String title;
@DatabaseField
private String description;
@DatabaseField
private Date dateCreated;
@DatabaseField
private Date dueDate;
@dabitdev
Copy link

dabitdev commented Jun 1, 2016

This doesn't compile in https://gist.github.com/horaceheaven/c85a9414dc787aa5c337#file-todo-java with ormlite4.48
The class needs a empty constructor and the constructor that you are using in the activity

@DatabaseTable(tableName = "todo")
public class Todo {

    @DatabaseField(generatedId = true)
    private Long id;

    @DatabaseField
    private String title;

    @DatabaseField
    private String description;

    @DatabaseField
    private Date dateCreated;

    @DatabaseField
    private Date dueDate;

    public Todo(){

    }

    public Todo(String title, String description, Date dateCreated, Date dueDate) {
        this.title = title;
        this.description = description;
        this.dateCreated = dateCreated;
        this.dueDate = dueDate;
    }
}

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